/*
程序: ESP32 OLED 使用 U8G2库
使用FREERTOS
公众号:孤独的二进制
*/
#include <U8g2lib.h>
#include <Wire.h>
void oledTask(void * pvParam) {
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
u8g2.begin();
for (;;) {
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr(15, 10, "LONELY BINARY"); // write something to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
vTaskDelay(1000);
}
}
void setup() { //loopBack , Priority 1, Core 1
xTaskCreatePinnedToCore(oledTask, "OLED Task", 1024 * 6, NULL, 1, NULL, 1);
vTaskDelete(NULL);
}
void loop() {
}