// TTGO 板载OLED的显示屏是128*64像素
// i2c address = 0x3c
// SDA = 5
// SCL = 4
// 显示屏驱动
// https://github.com/ThingPulse/esp8266-oled-ssd1306
#include "SSD1306.h"
uint8_t ledPin = 16; // LED
SSD1306 display(0x3c, 5, 4); // OLED. Addr, SDA, SCL
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_24);
display.setTextAlignment(TEXT_ALIGN_LEFT);
}
void loop() {
Serial.println("Hello, Superman!");
digitalWrite(ledPin, LOW);
delay(1000);
digitalWrite(ledPin, HIGH);
delay(1000);
display.clear();
display.drawString(0, 0, "Superman");
display.display();
}