#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
#define SCREEN_ADDRESS 0X3C
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 oled(SCREEN_WIDTH,SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// Initializing the OLED display with I2C address 0X3C
if (!oled.begin(SSD1306_SWITCHCAPVCC,0X3C)) {
Serial.println(F("Failed to start SSD1306 OLED"));
while(1);
}
// Delay time for initializing
delay(2000);
// Clear the display screen
oled.clearDisplay();
// Setting the text size
oled.setTextSize(1);
// Setting the text colour
oled.setTextColor(WHITE);
// Setting position to diaplay
oled.setCursor(30,20);
// Writing the text
oled.println("Hello World!");
// Display text on OLED
oled.display();
}
void loop() {
// put your main code here, to run repeatedly:
}