单片机学习小组
直播中

王树林

7年用户 1645经验值
私信 关注

U8G2如何连接Nodemcu-32s?

U8G2如何连接Nodemcu-32s?

回帖(1)

周彦楠

2022-2-15 14:06:45
#include
#include
#include

U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);        //这是1.3寸oled
//U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   //0.96寸的选择这个   SDA 21 SCL 22 All Boards without Reset of the Display
//U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0,SCL,SDA,U8X8_PIN_NONE);



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.firstPage();
  do {
    u8g2.setCursor(10, 20);
    u8g2.print("当前温度:32.06°");   // Chinese "Hello World"

    u8g2.setCursor(10, 40);
    u8g2.print("当前湿度:28.4%°");   // Chinese "Hello World"
  } while ( u8g2.nextPage() );
  delay(1000);
}
举报

更多回帖

发帖
×
20
完善资料,
赚取积分