#include #include Tem_Hum_S2  temHum2X;#include ColorLED strip = ColorLED(1, 6);long b;long a;U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);#define setFont_L u8g.setFont(u8g_font_unifont)#define setFont_S u8g.setFont(u8g_font_fixed_v0r)#define setFont_M u8g.setFont(u8g_font_9x15)void setup(){  strip.begin();  b = 0;  a = 0;  temHum2X.begin();}void loop(){  a = temHum2X.getTemperature();  b = temHum2X.getHumidity();  u8g.undoRotation();  u8g.firstPage();  do {    setFont_L;    u8g.setScale2x2();    u8g.setPrintPos(0, 10);    u8g.print(a);    u8g.undoScale();    setFont_L;    u8g.setScale2x2();    u8g.setPrintPos(0, 20);    u8g.print(b);    u8g.undoScale();  } while( u8g.nextPage() );  delay(100);  if (a > 10) {    strip.setPixelColor(1-1, 255,0,0);    strip.show();  } else if (a > 25 && a <= 30) {    strip.setPixelColor(1-1, 51,255,51);    strip.show();  } else {    strip.setPixelColor(1-1, 51,51,255);    strip.show();  }}
立即注册