SSD1306 OLED Reference
A 128×64 monochrome graphical OLED display, most commonly driven over I²C.
Pin names
| Name | Description |
|---|---|
| DATA | SDA — I²C data |
| CLK | SCL — I²C clock |
| DC | Data/Command (SPI mode only) |
| RST | Reset |
| CS | Chip Select (SPI mode only) |
| 3V3 | 3.3V power output |
| VIN | Power input (3.3V–5V) |
| GND | Ground |
Attributes
This component has no configurable attributes.
Usage
For I²C mode, connect VIN to 3.3V or 5V, GND to GND, DATA to the board's SDA pin
(A4 on an Uno), and CLK to SCL (A5 on an Uno). Drive it with the Adafruit SSD1306 + GFX
libraries. The default I²C address is 0x3C.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1 // share Arduino reset pin
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(2);
display.setCursor(0, 0);
display.println("Hello!");
display.setTextSize(1);
display.println("SSD1306 OLED");
display.println("128 x 64 pixels");
display.display();
}
void loop() {}
Examples
| Description | Attrs |
|---|---|
| Default 128×64 OLED | {} |
See also
- LCD 1602 — text-only alternative using a parallel bus instead of I²C
- ILI9341 TFT — full-colour graphical display over SPI