时间跳动
/* esp8266+oled项目实例*/#include <Arduino.h>#include <U8g2lib.h>#include <Wire.h>U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ D2, /* data=*/ D1, /* reset=*/ U8X8_PIN_NONE); // 此处 D1 D2是对应焊接的脚针 void setup(void) { u8g2.begin();} uint8_t m = 24; void loop(void) { char m_str[3]; strcpy(m_str, u8x8_u8toa(m, 2)); /* convert m to a string with two digits */ u8g2.firstPage(); do { u8g2.setFont(u8g2_font_logisoso62_tn); u8g2.drawStr(0,63,"9"); u8g2.drawStr(33,63,":"); u8g2.drawStr(50,63,m_str); } while ( u8g2.nextPage() ); delay(1000); m++; if ( m == 60 ) m = 0; }