当前位置: 代码迷 >> 综合 >> 【掌控板-arduino】7.1 联网获取时间
  详细解决方案

【掌控板-arduino】7.1 联网获取时间

热度:60   发布时间:2023-12-05 20:33:04.0

文章目录

  • 参考文章
  • 代码
  • 现象
  • 注意

参考文章

基于基于esp32的联网获取时间

ESP32通过WiFi从NTP服务器获取日期和时间的Arduino小小demo

使用Arduino开发ESP32(19):获取网络时间

代码

参见【掌控板-arduino】3.3 卡西欧太空人表盘

注意这里用的是64*64的太空人

#define Watch_Image_width 64
#define Watch_Image_height 64
const uint8_t Watch_Image1[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x7F,0x0C,0x00,0x00,0x00,0x00,0x00,0x1E,0xFE,0x1D,0x00,0x00,0x00,0x00,0x00,0x0E,0xDE,0x19,0x00,0x00,0x00,0x00,0x00,0x07,0xC0,0x33,0x00,0x00,0x00,0x00,0x80,0x03,0xC0,0xB3,0x01,0x00,0x00,0x00,0x80,0x01,0x80,0xE7,0x73,0x00,0x00,0x00,0xC0,0x01,0x80,0xC7,0x70,0x00,0x00,0x00,0xC0,0x00,0x80,0xCF,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x9E,0x01,0x00,0x00,0x00,0xE0,0x00,0x00,0x1E,0x03,0x00,0x00,0x00,0xE0,0x00,0x00,0x1C,0x03,0x18,0x00,0x00,0x60,0x00,0x00,0x18,0x06,0x3C,0x00,0x00,0xE0,0x00,0x00,0x18,0x04,0x3C,0x00,0x00,0xE0,0x01,0x00,0x18,0x0C,0x38,0x00,0x00,0xC0,0x01,0x00,0x18,0x18,0x00,0x00,0x00,0xC0,0x01,0x00,0x18,0x10,0x00,0x00,0x00,0xC0,0x03,0x00,0x0C,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x1C,0x00,0x18,0x00,0x00,0x80,0x03,0x00,0x3E,0x00,0x18,0x00,0x00,0x00,0x03,0x00,0x77,0x00,0x10,0x00,0x00,0x00,0x07,0x80,0xE7,0x00,0x00,0x00,0x00,0x00,0x1E,0xE0,0xDF,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0x9E,0x01,0x00,0x00,0x00,0x00,0xE0,0x3F,0x36,0x03,0x00,0x00,0x00,0x00,0x00,0x1F,0x3C,0x07,0x00,0x00,0x00,0x00,0x00,0x06,0xF8,0x07,0x60,0x00,0x00,0x00,0x00,0x06,0xF8,0x0C,0x00,0x00,0x00,0x00,0x00,0x0C,0xF8,0x0C,0x00,0x00,0x00,0x00,0x00,0x1C,0xF0,0x1E,0x00,0x00,0x00,0x00,0x00,0x18,0xE0,0x37,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x27,0x00,0x00,0x00,0x00,0x00,0x30,0x38,0x04,0x00,0x00,0x00,0x00,0x00,0x20,0x3C,0x0C,0x00,0x00,0x00,0x0C,0x00,0x60,0x3E,0x08,0x00,0x00,0x00,0x0C,0x00,0xE0,0x77,0x0C,0x00,0x00,0x00,0x0C,0x00,0xC0,0xE7,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x9C,0x37,0x00,0x00,0x00,0x00,0x80,0x01,0xF0,0x39,0x06,0x00,0x00,0x00,0x80,0x03,0xE0,0x1F,0x06,0x00,0x00,0x00,0x00,0x03,0xE0,0x0F,0x04,0x00,0x00,0x80,0x01,0x06,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x0E,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0x30,0x60,0x80,0x01,0x00,0x00,0x00,0xC0,0x71,0xE0,0x80,0x01,0x00,0x00,0x00,0x00,0x61,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
};
const uint8_t Watch_Image2[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x3E,0x02,0x1E,0x00,0x00,0x00,0x00,0x07,0x70,0x0E,0x0E,0x00,0x00,0x00,0x80,0x03,0xE0,0x0C,0x0E,0x00,0x00,0x00,0xC0,0x03,0x80,0x19,0x18,0x00,0x00,0x00,0xC0,0x01,0x80,0x33,0x00,0x00,0x00,0x00,0xEC,0x01,0x00,0x33,0x00,0x00,0x00,0x00,0xE6,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x06,0x00,0x00,0xF6,0x1F,0x00,0xC6,0x00,0x06,0x00,0x00,0xF6,0x7F,0x00,0xC7,0x01,0x06,0x00,0x00,0xF6,0xFF,0x00,0x87,0x01,0x00,0x00,0x00,0xF6,0xFF,0x01,0x06,0x03,0x00,0x00,0x00,0xF6,0xFF,0x01,0x06,0x06,0x01,0x00,0x00,0xE6,0xFF,0x03,0x06,0x86,0x03,0x00,0x00,0xE6,0xFF,0x07,0x0E,0x04,0x01,0x00,0x00,0xE6,0xFF,0x07,0x1F,0x00,0x00,0x00,0x00,0xC0,0xFF,0x07,0x33,0x00,0x00,0x00,0x00,0xC0,0xFF,0x87,0x2F,0x00,0x00,0x00,0x00,0x80,0xFF,0xC7,0x3D,0x00,0x00,0x00,0x30,0x00,0xFF,0xE7,0x78,0x00,0x00,0x00,0x60,0x00,0xFF,0x77,0xE0,0x00,0x0C,0x00,0x40,0x00,0xFC,0x3F,0xC3,0x01,0x1C,0x00,0x70,0x00,0xF8,0x0F,0xCF,0x01,0x1C,0x00,0x00,0x00,0x00,0x06,0xFC,0x03,0x1C,0x00,0x00,0x00,0x00,0x0E,0x78,0x03,0x00,0x00,0x00,0x00,0x00,0x0C,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x0C,0xE3,0x01,0x00,0x00,0x00,0x00,0x00,0x9C,0xC7,0x03,0x00,0x00,0x00,0x00,0x00,0xD8,0x66,0x03,0x00,0x00,0x00,0x00,0x00,0xB8,0x3F,0x06,0x00,0x00,0x80,0x01,0x00,0x30,0x1B,0x06,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0xF0,0x03,0x06,0x06,0x00,0x00,0x00,0x00,0xC0,0x31,0x0F,0x0C,0x00,0x00,0x00,0x00,0x80,0xF3,0x1B,0x0C,0x00,0x00,0x00,0x80,0x00,0xE6,0x0D,0x00,0x00,0x00,0x00,0x80,0x01,0xFC,0x07,0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x03,0x01,0x00,0x00,0x00,0x00,0x06,0xF0,0x01,0x03,0x00,0x00,0x00,0x00,0x06,0x60,0x00,0x03,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const uint8_t Watch_Image3[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0xF8,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xC3,0x01,0x00,0x00,0x00,0x00,0x00,0xFE,0x9F,0x03,0x00,0x00,0x00,0x00,0x00,0x3F,0x1C,0x60,0x00,0x00,0x00,0x00,0x80,0x0F,0x70,0x70,0x00,0x00,0x00,0x00,0xC0,0x00,0xC0,0x70,0x00,0x00,0x00,0x00,0x40,0xF8,0xC0,0x61,0x0C,0x00,0x00,0x00,0x60,0xFE,0x83,0x01,0x04,0x00,0x00,0x00,0x20,0xFF,0x87,0x03,0x00,0x00,0x00,0x00,0xB0,0xFF,0x8F,0x03,0x00,0x00,0x00,0x00,0xB0,0xFF,0x1F,0x03,0x80,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x03,0x80,0x00,0x00,0x00,0xD0,0xFF,0x3F,0x03,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x03,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x03,0x00,0x00,0x00,0x00,0xF0,0xFF,0xBF,0x03,0x00,0x00,0x00,0x00,0xE0,0xFF,0xBF,0x07,0x00,0x00,0x00,0x00,0xE0,0xFF,0xBF,0x0F,0x40,0x00,0x00,0x00,0xE0,0xFF,0xDF,0x1D,0x40,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x30,0x00,0x00,0x00,0x00,0xB0,0xFF,0x3F,0x66,0x00,0x00,0x00,0x00,0x30,0xFF,0x3F,0xCE,0x00,0x0C,0x00,0x00,0x60,0xFE,0x0F,0xDC,0x01,0x08,0x00,0x00,0xC0,0xF8,0x07,0x70,0x0F,0x00,0x00,0x00,0xC0,0x80,0x01,0x3C,0x1E,0x00,0x00,0x00,0x80,0x01,0x03,0xFE,0x1B,0x00,0x00,0x00,0x00,0x03,0x03,0xD2,0x19,0x00,0x00,0x00,0x00,0x03,0x07,0xDE,0x30,0x00,0x00,0x00,0x00,0x06,0x77,0xFC,0x61,0x00,0x00,0x80,0x00,0x06,0xFF,0x20,0xE1,0x00,0x00,0x80,0x01,0x0C,0xDE,0x01,0x41,0x00,0x00,0x00,0x00,0x18,0xFC,0x02,0x01,0x00,0x00,0x00,0x00,0x18,0xFC,0x13,0x0B,0x00,0x00,0x00,0x00,0x10,0xFC,0xB1,0x1F,0x00,0x00,0x00,0xE0,0x00,0xD0,0xF3,0x35,0x00,0x00,0x00,0xA0,0x00,0x00,0x77,0x36,0x00,0x00,0x00,0xE0,0x00,0x00,0xFC,0x03,0x00,0x00,0x00,0xC0,0x00,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x79,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x33,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x03,0x30,0x00,0x00,0x00,0x0C,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const uint8_t Watch_Image4[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x7F,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x70,0x00,0x00,0x00,0x00,0x00,0xE0,0xC3,0x38,0x00,0x00,0x00,0x00,0x00,0xFC,0x8F,0x6B,0x00,0x00,0x00,0x00,0x00,0x3E,0x1F,0x03,0x00,0x00,0x00,0x00,0x80,0x9F,0x7F,0x06,0x00,0x00,0x00,0x00,0xC0,0xC7,0xFF,0x04,0x00,0x00,0x00,0x00,0xC0,0xE3,0xFF,0x00,0x00,0x00,0x00,0x00,0xE0,0xE3,0xFF,0x01,0x00,0x00,0x00,0x00,0x60,0xF0,0xFF,0x01,0x00,0x00,0x00,0x00,0x70,0xF0,0xFF,0x83,0x01,0x00,0x00,0x00,0x30,0xF0,0xFF,0x83,0x01,0x00,0x00,0x00,0x30,0xF0,0xFF,0x83,0x01,0x00,0x00,0x00,0x30,0xF0,0xFF,0x03,0x00,0x00,0x00,0x00,0x30,0xF0,0xFF,0x03,0x00,0x00,0x00,0x00,0x30,0xF0,0xFF,0x03,0x00,0x00,0x00,0x00,0x30,0xF0,0xFF,0x03,0x00,0x00,0x00,0x00,0x30,0xE0,0xFF,0x03,0x00,0x00,0x00,0x00,0x30,0xE0,0xFF,0x03,0x00,0x00,0x00,0x00,0x70,0xC0,0xFF,0x03,0x10,0x00,0x00,0x00,0x60,0x80,0xFF,0x07,0x10,0x00,0x00,0x00,0xC0,0x01,0xFE,0x1E,0x00,0x00,0x00,0x00,0xC0,0x03,0xE0,0x1C,0x00,0x00,0x00,0x30,0x80,0x37,0x70,0x3C,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0xF8,0x00,0x38,0x00,0x00,0x00,0xF8,0x0F,0xE0,0x01,0x38,0x00,0x00,0x00,0x00,0x03,0xE0,0x01,0x18,0x00,0x00,0xC0,0x00,0x1B,0xE0,0x01,0x20,0x00,0x10,0xC0,0x01,0x1B,0xE7,0x03,0x00,0x00,0x00,0x80,0x01,0x1B,0xCF,0x07,0x00,0x00,0x00,0x80,0x03,0x9B,0xCD,0x07,0x00,0x00,0x00,0x00,0x02,0x33,0xEF,0x01,0x00,0x00,0x00,0x00,0x0C,0x76,0x06,0x01,0x00,0x00,0x00,0x00,0x0C,0x7E,0x00,0x03,0x00,0x00,0x00,0x00,0x08,0x7E,0x62,0x03,0xE0,0x00,0x00,0x00,0x30,0xEC,0xE1,0x03,0x60,0x00,0x00,0x01,0x30,0xFC,0xC1,0x07,0x60,0x00,0x00,0x00,0x60,0xB8,0xE1,0x07,0xC0,0x00,0x00,0x00,0xE0,0x00,0xF3,0x07,0xC0,0x00,0x00,0x80,0xC3,0x00,0xBE,0x01,0x80,0x01,0x00,0xC0,0xC3,0x00,0xDC,0x00,0x00,0x01,0x00,0xC6,0x83,0x01,0xF8,0x00,0x00,0x00,0x00,0xC4,0x02,0xC1,0x38,0x00,0x04,0x00,0x00,0x00,0x03,0x80,0x01,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};const uint8_t Watch_EMPTY[] PROGMEM = {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};

#include <Arduino.h>
#include <WiFi.h>
#define DEBUG_WIFI 1String data_time_date = "2022-1-12";  // year-month-day
String data_time_clock = "12:17:20"; // hour-min-sec
String data_time_week = "Wednesday";  // week
String data_weather = "晴";  // weather// wifi
//https://www.arduino.cn/thread-93795-1-1.html
//https://blog.csdn.net/DWX_top/article/details/120650278#define NTP1 "ntp1.aliyun.com"
#define NTP2 "ntp2.aliyun.com"
#define NTP3 "ntp3.aliyun.com"const char *ssid = "youkai";         
const char *password = "19971226";     const String WDAY_NAMES[] = {
    "星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; //星期
const String WDAY_NAMES_CHAR[] = {
    "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; //星期
const String MONTH_NAMES[] = {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; //月份// patter0 watch display
#include "watch_bmp.h"
int watch_image_current = 0;   // save now display image number
#define WATCH_IMAGE_NUM 4
const uint8_t * watch_image_addr[WATCH_IMAGE_NUM]={
    Watch_Image1,Watch_Image2,Watch_Image3,Watch_Image4};// display
#include "SH1106Wire.h"
SH1106Wire display(0x3c, 23, 22);   void setClock()
{
    Serial.println("enter setclock");struct tm timeInfo; if (!getLocalTime(&timeInfo)){
     //一定要加这个条件判断,否则内存溢出Serial.println("Failed to obtain time");return;}//Serial.print(asctime(&timeInfo)); //默认打印格式:Mon Oct 25 11:13:29 2021String date = WDAY_NAMES[timeInfo.tm_wday];data_time_date = String(timeInfo.tm_year + 1900); //yeardata_time_date += "-";if(timeInfo.tm_mon < 10)data_time_date += "0";data_time_date += timeInfo.tm_mon + 1; //monthdata_time_date += "-";if(timeInfo.tm_mday < 10)data_time_date += "0";data_time_date += timeInfo.tm_mday; //dayif(timeInfo.tm_hour < 10)data_time_clock += "0";data_time_clock = String(timeInfo.tm_hour); //hourdata_time_clock += ":";if(timeInfo.tm_min < 10)data_time_clock += "0";data_time_clock += timeInfo.tm_min; //mindata_time_clock += ":";if(timeInfo.tm_sec < 10)data_time_clock += "0";data_time_clock += timeInfo.tm_sec; //secdata_time_week = WDAY_NAMES_CHAR[timeInfo.tm_wday]; //weekSerial.print("data_time_date:");Serial.println(data_time_date);Serial.print("data_time_clock:");Serial.println(data_time_clock);Serial.print("data_time_week:");Serial.println(data_time_week);}void display_time()
{
    
#if DEBUG_WIFIsetClock();
#endifdisplay.drawString(64,0,data_time_date);display.drawString(64,16,data_time_clock);display.drawString(64,32,data_time_week);
// display.display();
}void display_weather()
{
    display.drawXbm(64,48,32,16,WEATHER2);
// display.display();
}void drawImageDemo_64_64_w(int picture_num) {
    // see http://blog.squix.org/2015/05/esp8266-nodemcu-how-to-create-xbm.html// on how to create xbm filesif(picture_num <0 || picture_num > 3){
    Serial.println("error picture_num");picture_num = 0;}  display.drawXbm(0, 0, Watch_Image_width, Watch_Image_height, watch_image_addr[picture_num]);}void display_bmp_watch(){
    
// display.clear();drawImageDemo_64_64_w(watch_image_current);// display.display();
}void wifi_init()
{
    //设置ESP32工作模式为无线终端模式WiFi.mode(WIFI_STA);WiFi.begin(ssid, password);while (WiFi.status() != WL_CONNECTED){
    delay(500);Serial.print(".");}Serial.println("WiFi connected!");Serial.println("before configtime");configTime(8 * 3600, 0, NTP1, NTP2, NTP3);Serial.println("after configtime!");// display.clear();
// display.drawString(0,0,"WiFi connected!");
// display.display();
// delay(3000);}//enter pattern1(weather/time) 
void pattern_solution1()
{
      //display watch imageif (watch_image_current < WATCH_IMAGE_NUM -1 )watch_image_current++;else watch_image_current=0;display.clear();Serial.println("start pict");display_bmp_watch();Serial.println("end pict");display_time();display_weather();display.display();//display 4 picture delay timedelay(100);
}void setup() {
    Serial.begin(115200);Serial.println("enter setup");// connect wifi
#if DEBUG_WIFIwifi_init();
#endif// init displaydisplay.init();display.flipScreenVertically();display.setFont(ArialMT_Plain_10);Serial.println("exit setup");
}void loop() {
    pattern_solution1();}

现象

卡西欧太空人表盘显示时间

注意

问题:增加上时间显示的时候,明显感觉到屏幕右半边有闪烁
分析方法:在显示前后打上log,然后通过串口监视器查看log,发现显示图片前后时间差为0.047s.
我们常见的视频需要24帧,即每张图的间隔时间不能超过0.417s,否则人会感知到。
所以出现了闪烁。

display.clear();Serial.println("start pict");display_bmp_watch();Serial.println("end pict");display_time();display_weather();display.display();

在这里插入图片描述

原因:
这是因为我在display_bmp_watch()中增加了display.display();
将其删除,然后在所有数据都打印好后再显示。

void display_bmp_watch(){
    
// display.clear();drawImageDemo_64_64_w(watch_image_current);display.display();
}void pattern_solution1()
{
      display.clear();		//清空Serial.println("start pict");display_bmp_watch();Serial.println("end pict");display_time();display_weather();display.display();	//显示delay(100);
}
  相关解决方案