#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED的宽度
#define SCREEN_HEIGHT 64 // OLED的高度
#define OLED_RESET 4 // 复位引脚,没接,不用管
//这里面会初始化IIC
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);//初始化串口波特率为115200 bit/s
Serial.println("Hello, ESP32!");//打印字符串
pinMode(15, OUTPUT);//设置D15为输出模式
Serial.println("PIN Init success!");//打印字符串
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);//初始化OLED
display.display();//把缓冲区的内容显示到屏幕上
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(15, LOW);//输出低电平,LED点亮
delay(500); // this speeds up the simulation
digitalWrite(15, HIGH);//输出高电平,LED熄灭
delay(500);
}