8266 nodemcu 连接0.96寸128*64的oled屏例程。
#include
#include
#include
#include
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
//sda = GPIO3 --SDA-->D1
//scl = GPIO4 --SCL-->D2;VCC-->3V GPIO0接地GND 进入写模式,运行模式要去除
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)8266 设置为-1,arduino 设置为4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
1