esp32 OLED_mini手表
实际效果
https://www.bilibili.com/video/BV16t4y1M758/
代码
#include "Wire.h"
#include "SSD1306.h"
#include <WiFi.h>
#include <TimeLib.h>
#include <NtpClientLib.h>
int8_t timeZone = 8;
const PROGMEM char *ntpServer = "ntp1.aliyun.com";
SSD1306Wire display(0x3c,21,18);
unsigned char image[][512] = {
/*-- 调入了一幅图像:C:\Users\chen\Desktop\esp32_Test\Taiji.bmp --*/
/*-- 宽度x高度=64x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,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,0x60,0x66,0x3E,0xC0,0xC0,0x00,
0x00,0xC0,0x60,0x6E,0xE6,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0x6C,0x63,0xC0,0x60,0x00,
0x00,0xE0,0xF1,0x79,0x61,0xFC,0x0F,0x00,0x00,0x30,0x9B,0x61,0xFC,0xC1,0x00,0x00,
0x00,0xFC,0xFF,0xFE,0x67,0xFE,0xFF,0x01,0x00,0x00,0x03,0x06,0x66,0x00,0x60,0x00,
0x00,0x00,0x03,0x06,0xF6,0xFC,0x6F,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0x0C,0x6C,0x00,
0x00,0x60,0x00,0x06,0xFE,0xFD,0x6F,0x00,0x00,0x60,0x00,0x06,0x6E,0x0D,0x6C,0x00,
0x00,0xFE,0xFF,0xFF,0x67,0xFC,0x7F,0x00,0x00,0x60,0x38,0x06,0x66,0x0C,0x7C,0x00,
0x00,0x60,0x1C,0x7C,0x66,0x7C,0xCC,0x00,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,
/*-- 调入了一幅图像:C:\Users\chen\Desktop\esp32_Test\Clock.bmp --*/
/*-- 宽度x高度=64x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,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,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x03,0x00,0x00,
0x00,0x00,0xF0,0x7F,0xFE,0x0F,0x00,0x00,0x00,0x00,0xF8,0x03,0xC0,0x1F,0x00,0x00,
0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0xFC,0x00,0x00,
0x00,0x80,0x0F,0x00,0x00,0xF0,0x01,0x00,0x00,0xC0,0x07,0x00,0x00,0xE0,0x03,0x00,
0x00,0xE0,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0xE0,0x01,0x00,0x00,0x80,0x07,0x00,
0x00,0xF0,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x1E,0x00,
0x00,0x78,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x3C,0x00,
0x00,0x1C,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x78,0x00,
0x00,0x1E,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x70,0x00,
0x00,0x0E,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x70,0x00,
0x00,0x0E,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xCF,0xFF,0xFF,0x00,0x00,0xF0,0x00,
0x00,0xE7,0xFF,0xFF,0x03,0x00,0xE0,0x00,0x00,0xE7,0xFF,0xFF,0x07,0x00,0xE0,0x00,
0x00,0x0F,0x00,0x00,0x0F,0x00,0xF0,0x00,0x00,0x0E,0x00,0x00,0x1E,0x00,0xF0,0x00,
0x00,0x0E,0x00,0x00,0x3C,0x00,0x70,0x00,0x00,0x0E,0x00,0x00,0x78,0x00,0x70,0x00,
0x00,0x0E,0x00,0x00,0xF0,0x00,0x70,0x00,0x00,0x1E,0x00,0x00,0xE0,0x01,0x78,0x00,
0x00,0x1C,0x00,0x00,0xC0,0x03,0x78,0x00,0x00,0x1C,0x00,0x00,0x80,0x07,0x38,0x00,
0x00,0x3C,0x00,0x00,0x00,0x07,0x3C,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x1E,0x00,
0x00,0x78,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x0F,0x00,
0x00,0xE0,0x01,0x00,0x00,0x80,0x07,0x00,0x00,0xE0,0x01,0x00,0x00,0x80,0x07,0x00,
0x00,0xC0,0x07,0x00,0x00,0xE0,0x03,0x00,0x00,0x80,0x0F,0x00,0x00,0xF0,0x01,0x00,
0x00,0x00,0x3F,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,
0x00,0x00,0xF8,0x03,0xC0,0x1F,0x00,0x00,0x00,0x00,0xF0,0x7F,0xFE,0x0F,0x00,0x00,
0x00,0x00,0xC0,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0x00,0x00,0x00,
0x00,0x00,0x00,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 调入了一幅图像:C:\Users\chen\Desktop\esp32_Test\moon.bmp --*/
/*-- 宽度x高度=64x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x7F,0x00,0x00,0x00,
0x00,0x00,0x00,0xF8,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x07,0x00,0x00,
0x00,0x00,0x00,0xC0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x3F,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x03,0x00,
0x00,0x00,0x00,0x00,0xF8,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0x07,0x00,
0x00,0x00,0x00,0x00,0xF8,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,
0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,
0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x3F,0x00,
0x00,0x00,0x00,0x00,0xE0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xF0,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xF0,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xF8,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xFC,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x7F,0x00,
0x00,0x00,0x00,0x00,0xFE,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x3F,0x00,
0x00,0x00,0x00,0x80,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x3F,0x00,
0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,0x00,0x80,0x00,0x00,0xF8,0xFF,0xFF,0x1F,0x00,
0x80,0x03,0x00,0xFE,0xFF,0xFF,0x1F,0x00,0x00,0x0F,0xC0,0xFF,0xFF,0xFF,0x0F,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x07,0x00,
0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x01,0x00,
0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x7F,0x00,0x00,
0x00,0xC0,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x1F,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0x03,0x00,0x00,
0x00,0x00,0xF0,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x0F,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 调入了一幅图像:C:\Users\chen\Desktop\esp32_Test\sun.bmp --*/
/*-- 宽度x高度=64x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0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FF,0xFF,0x01,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,
0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,
0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,
0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0x07,0x00,
0x00,0x80,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x01,0x00,
0x00,0x00,0xFC,0xFF,0xFF,0x7F,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x3F,0x00,0x00,
0x00,0x00,0xE0,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x03,0x00,0x00,
0x00,0x00,0x00,0xFC,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- 调入了一幅图像:C:\Users\chen\Desktop\esp32_Test\web.bmp --*/
/*-- 宽度x高度=64x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x03,0x00,0x00,
0x00,0x00,0xF0,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0xFC,0xC3,0xC3,0x3F,0x00,0x00,
0x00,0x00,0x7E,0xC0,0x03,0x7E,0x00,0x00,0x00,0x80,0x1F,0xC0,0x03,0xF8,0x01,0x00,
0x00,0xC0,0x1F,0xC0,0x03,0xF8,0x03,0x00,0x00,0xE0,0x1F,0xC0,0x03,0xF8,0x07,0x00,
0x00,0xF0,0x1D,0xC0,0x03,0xB8,0x0F,0x00,0x00,0xF8,0x1C,0xC0,0x03,0x38,0x1F,0x00,
0x00,0x78,0x1C,0xC0,0x03,0x38,0x1E,0x00,0x00,0x3C,0x1C,0xC0,0x03,0x38,0x3C,0x00,
0x00,0x1E,0x1C,0xFE,0x7F,0x38,0x78,0x00,0x00,0x0E,0xFC,0xFF,0xFF,0x3F,0x70,0x00,
0x00,0x0F,0xFE,0xFF,0xFF,0x7F,0xF0,0x00,0x00,0x87,0xFF,0xC1,0x83,0xFF,0xE1,0x00,
0x80,0xE7,0x1F,0xC0,0x03,0xF8,0xE7,0x01,0x80,0xFB,0x1F,0xC0,0x03,0xF8,0xDF,0x01,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x03,0xF8,0x03,0x00,
0x00,0x80,0x1F,0xC0,0x03,0xF8,0x01,0x00,0x00,0x00,0x7E,0xC0,0x03,0x7E,0x00,0x00,
0x00,0x00,0xFC,0xC3,0xC3,0x3F,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x0F,0x00,0x00,
0x00,0x00,0xC0,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
unsigned char State = 0;
unsigned char Last_State = 0;
unsigned char OLED_Setting = 0xff;
void OLED_State();
void Setting();
void gotTouch12() {
delay(30);
if(touchRead(12) <= 40){
while(touchRead(12) <= 40);
if(State == 0)State = 5;
State --;
}
}
void gotTouch13() {
delay(30);
if(touchRead(13) <= 40){
while(touchRead(13) <= 40);
State ++;
if(State == 5)State = 0;
}
}
void gotTouch14() {
delay(30);
if(touchRead(14) <= 40){
while(touchRead(14) <= 40);
if(OLED_Setting == 0xff)
OLED_Setting = State;
else
OLED_Setting = 0xff;
}
}
void setup() {
// put your setup code here, to run once:
/*displayinit*/
display.init();
display.flipScreenVertically();
display.drawFastImage(32,0,64,64,image[Last_State]);
display.display();
/**************************Touch******************/
touchAttachInterrupt(12,gotTouch12, 40);
touchAttachInterrupt(13,gotTouch13, 40);
touchAttachInterrupt(14,gotTouch14, 40);
Serial.begin(9600);
/*****Wifi Set Up*/
WiFi.begin("Internet Of Things Skills", "ThingInternets@fSkillsB44752");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
/***********Get Time***********/
NTP.setInterval (600);
NTP.setNTPTimeout (1500);
NTP.begin (ntpServer, timeZone, false);
}
void loop() {
// put your main code here, to run repeatedly:
OLED_State();
//OLED_Setting = 3;
Setting();
/*
display.clear();
display.setFont(ArialMT_Plain_16);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawString(16,0,NTP.getTimeDateString());
display.drawString(16,16,NTP.getTimeStr());
display.drawString(16,63-16,"121231");
display.display();*/
}
void OLED_State(){
if(Last_State != State){
if(Last_State<State){
unsigned char i;
for(i = 0;i < 128;i+=(i>40?(i<80?12:3):3)){
display.clear();
display.drawFastImage((128-64-32)-i,0,64,64,image[Last_State]);
display.drawFastImage(128-i+32,0,64,64,image[Last_State+1]);
display.display();
}
Last_State++;
}
else if(Last_State>State){
unsigned char i;
for(i = 0;i < 128;i+=(i>40?(i<80?12:3):3)){
display.clear();
display.drawFastImage(i+32,0,64,64,image[Last_State]);
display.drawFastImage(i+32-128,0,64,64,image[Last_State-1]);
display.display();
}
Last_State--;
}
//Last_State = State;
}
}
void Setting(){
char arr[30];
if(Last_State == 0){
display.clear();
display.setFont(ArialMT_Plain_24);
sprintf(arr,"%04d/%02d/%02d",year(),month(),day());
display.drawString(0,0,arr);
sprintf(arr,"%02d:%02d:%02d", hour(),minute(),second());
display.drawString(0,32,arr);
display.display();
}
if(State == 1){
delay(500);
display.clear();
display.drawCircle(126/2,64/2,30);
display.drawLine(126/2,64/2,63+26*cos((90-6*second())*3.1415926/180),32-26*sin((90-6*second())*3.1415926/180));
display.drawLine(126/2,64/2,63+20*cos((90-6*minute())*3.1415926/180),32-20*sin((90-6*minute())*3.1415926/180));
display.drawLine(126/2,64/2,63+13*cos((90-30*hour()-minute()/2)*3.1415926/180),32-13*sin((90-30*hour()-minute()/2)*3.1415926/180));
display.display();
}
if(OLED_Setting == 2){
display.clear();
display.drawFastImage(32,0,64,64,image[State]);
display.normalDisplay();
display.display();
}
if(OLED_Setting == 3){
display.clear();
display.drawFastImage(32,0,64,64,image[State]);
display.invertDisplay();
display.display();
}
if(OLED_Setting == 4){
display.clear();
display.display();
}
if(OLED_Setting == 0xff&&State != 0){
display.drawFastImage(32,0,64,64,image[State]);
}
}
标签:mini,0xC0,手表,0x00,0x01,0x03,OLED,0xFF,0x7F
From: https://www.cnblogs.com/Xin-chen/p/16851039.html