The Adafruit OLED Monochrome 128x64 0.96 inch display module is a compact and energy-efficient display that offers high contrast and wide viewing angles. Utilizing Organic Light Emitting Diode (OLED) technology, this display does not require a backlight and can display deep blacks by turning off individual pixels. It is commonly used in wearable devices, portable instruments, and various embedded systems where a small, high-quality display is required.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VCC | Power supply (3.3V to 5V) |
3 | SCL | I2C clock line |
4 | SDA | I2C data line |
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SCL, SDA pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// Initialize with the I2C addr 0x3C (for the 128x64)
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.display();
delay(2000); // Pause for 2 seconds
// Clear the buffer
display.clearDisplay();
// Draw a single pixel in white
display.drawPixel(10, 10, SSD1306_WHITE);
// Display the drawing
display.display();
}
void loop() {
// Nothing here for this simple example
}
Q: Can I use this display with a 5V microcontroller? A: Yes, but ensure that the I2C lines are level-shifted to be safe for the display.
Q: How do I invert the display colors?
A: Use the display.invertDisplay(true)
function to invert the colors on the display.
Q: What is the lifespan of the OLED display? A: OLED displays typically have a lifespan of around 5,000 to 15,000 hours of continuous operation, depending on usage and environmental conditions.