#include <Wire.h>
#include <Adafruit_GFX.h> //**********************************
#include <Adafruit_SSD1306.h> //****************************
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
//Declare objects
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//SSD1306_SWITCHCAPVCC = generate display voltage from 3.3v internally
if(! display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)){
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
//show the display buffer on the screen. you MUST call display()after
//drawing commands to make them visible on screen!
display.display();
delay(1000);
//clear the buffer
display.clearDisplay();
print_line();
}
void loop() {
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}
void print_line(void){
//clear the buffer
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,0);
display.println(F("Welcome 1"));
display.display();
delay(1000);
display.clearDisplay();
display.setCursor(20,20);
display.println(F("Welcome 2"));
display.display();
delay(1000);
}