#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define OLED display width and height
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Declare the I2C address for the OLED display
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// Initialize the display
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
// Clear the buffer
display.clearDisplay();
// Set text size, you can change this value to make the text bigger/smaller
display.setTextSize(2); // 1 is default, 2 makes it twice as big
// Set text color to white
display.setTextColor(SSD1306_WHITE);
// Set cursor position (x, y) on the screen
display.setCursor(0, 10); // (0,10) moves the text slightly down from the top-left corner
// Display the text
display.println("Hello, World!");
// Push everything to the display
display.display();
}
void loop() {
// Nothing to do in the loop for now
}