Adafruit SSD1306
by Adafruit
This is the low-level driver for SSD1306-controller OLED displays — it handles I2C/SPI communication and the display's internal command set, while all the actual drawing (text, shapes, bitmaps) comes from Adafruit's separate GFX library that this one depends on. Nothing appears on screen until you call `display.display()`, which flushes the in-memory frame buffer over the bus in one shot — every `print()`, `drawLine()`, or `fillRect()` before that just edits the buffer. Because the buffer-then-flush pattern is shared by nearly every Adafruit graphics display driver, learning it here transfers directly to other OLED and e-ink parts.
Installation
Arduino IDE — Library Manager
Sketch → Include Library → Manage Libraries → search Adafruit SSD1306
PlatformIO
lib_deps = adafruit/Adafruit SSD1306Supported boards
Examples
Initialize and print text
The baseline pattern behind every SSD1306 example on this site - note the required display() call at the end.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("Hello, SolderHub");
display.display(); // nothing shows until this is called
}
void loop() {}Partial redraw without flicker
Clearing only the region you're about to rewrite avoids the flash of a full clearDisplay() on every update.
display.fillRect(0, 20, 128, 10, SSD1306_BLACK); // clear just this strip
display.setCursor(0, 20);
display.print("Uptime: ");
display.print(seconds);
display.display();