#include <Arduino.h>
#include <U8g2lib.h>
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 26, /* data=*/ 25, /* reset=*/ U8X8_PIN_NONE); // ESP32 Thing, pure SW emulated I2C
void setup(void) {
u8g2.begin();
u8g2.enableUTF8Print(); // enable UTF8 support for the Arduino print() function
}
void loop(void) {
u8g2.setFont(u8g2_font_unifont_t_chinese2); // use chinese2 for all the glyphs of "你好世界"
u8g2.setFontDirection(0);
u8g2.clearBuffer();
u8g2.setCursor(0, 15);
u8g2.print("Hello");
u8g2.setCursor(0, 40);
u8g2.print("你好"); // Chinese "Hello World"
u8g2.sendBuffer();
delay(1000);
}
标签:U8G2,u8g2,中文,ESP32,print,void,setCursor From: https://www.cnblogs.com/ff888/p/16969930.html