#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1 // Reset pin not used
#define SCREEN_ADDRESS 0x3C // I2C Address from Scanner
Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire, OLED_RESET);
void setup() {
Serial.begin(115200);
Wire.begin(); // Initialize I2C
// Initialize OLED Display
if (!display.begin(SCREEN_ADDRESS, true)) { // true = Rotate display
Serial.println("SH1107 OLED not found. Check wiring.");
while (1); // Halt if OLED not found
}
Serial.println("SH1107 OLED Initialized!");
// Clear display
display.clearDisplay();
display.display();
// Set text settings
display.setTextSize(1);
display.setTextColor(SH110X_WHITE);
display.setCursor(10, 20);
display.println("Hello World!");
// Update display
display.display();
}
void loop() {
// Nothing needed here, the display holds static text
}