#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
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
oled.setRotation(2); // "flips" screen upside down
oled.setTextSize(2); // larger characters
oled.setTextColor(SSD1306_WHITE, SSD1306_BLACK); // draw white on black
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
oled.display();
delay(1000);
oled.clearDisplay();
oled.setCursor(30, 10);
oled.print("Hello");
oled.setCursor(30, 40);
oled.print("world!");
oled.display();
}
void loop() {
// put your main code here, to run repeatedly:
}