首页 > 其他分享 >ESP32-U8G2中文显示

ESP32-U8G2中文显示

时间:2022-12-09 20:22:21浏览次数:73  
标签:U8G2 u8g2 中文 ESP32 print void setCursor

#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

相关文章