项目总览
先上图,看效果! 该项目主要是通过esp8266-12e连接wifi获取心知天气数据和苏宁时间api,通过解析json代码得到数据,然后通过e-paper墨水屏显示出来,本项目基于墨水屏例程,添加了部分中文字体以及天气图标,通过文字取模软件对图标和文字进行了编码与取模。
元器件清单
- 主控板:esp8266-12e nodemcu
- 显示屏:heltec1.54inch e-link display的高亮样式** 进行展示;
- 杜邦线,usb线;
接线方式
- D/C–>D2
- SDI–>D7
- CS–>D8
- CLK–>D5
- BUSY–>D1
- VCC–>D0(一定要保证3.3v)
- GND–>GND
用到的网站与API
- 心知天气:https://www.seniverse.com/
- 天气解析获取三天天气地址:
http://api.seniverse.com/v3/weather/daily.json?key=YOUR EY&location=jinan&language=zh-Hans&unit=c - 记得修改标记位置,分别是心知天气私钥和城市代码
- 私钥获取方式>>官网注册>>购买免费版>>控制台>>添加私钥
获取到的json代码块示例
{
"results": [
{
"location": {
"id": "WWE0TGW4PX6N",
"name": "济南",
"country": "CN",
"path": "济南,济南,山东,中国",
"timezone": "Asia/Shanghai",
"timezone_offset": "+08:00"
},
"daily": [
{
"date": "2021-08-14",
"text_day": "晴",
"code_day": "0",
"text_night": "晴",
"code_night": "1",
"high": "30",
"low": "21",
"rainfall": "1.2",
"precip": "0.34",
"wind_direction": "东",
"wind_direction_degree": "90",
"wind_speed": "23.4",
"wind_scale": "4",
"humidity": "66"
},
{
"date": "2021-08-15",
"text_day": "多云",
"code_day": "4",
"text_night": "多云",
"code_night": "4",
"high": "31",
"low": "21",
"rainfall": "1.2",
"precip": "0.34",
"wind_direction": "东北",
"wind_direction_degree": "45",
"wind_speed": "8.4",
"wind_scale": "2",
"humidity": "66"
},
{
"date": "2021-08-16",
"text_day": "多云",
"code_day": "4",
"text_night": "多云",
"code_night": "4",
"high": "31",
"low": "21",
"rainfall": "1.2",
"precip": "0.35",
"wind_direction": "无持续风向",
"wind_direction_degree": "",
"wind_speed": "3.0",
"wind_scale": "1",
"humidity": "71"
}
],
"last_update": "2021-08-14T08:00:00+08:00"
}
]
}
- 苏宁时间api:http://quan.suning.com/getSysTime.do
{
"sysTime2": "2021-08-15 11:34:54",
"sysTime1": "20210815113454"
}
- arduinojson:https://arduinojson.org/assistant/
- 主要是用来esp8266解析获取到的网页数据
- 注意选择v5版本
- 示例:需要解析的数据
{
"sysTime2": "2021-08-15 11:34:54",
"sysTime1": "20210815113454"
}
const size_t capacity = JSON_OBJECT_SIZE(2) + 60;
DynamicJsonBuffer jsonBuffer(capacity);
const char* json = "{\"sysTime2\":\"2021-08-15 11:34:54\",\"sysTime1\":\"20210815113454\"}";
JsonObject& root = jsonBuffer.parseObject(json);
const char* sysTime2 = root["sysTime2"];
const char* sysTime1 = root["sysTime1"];
只需要将const char* json = 注释掉,然后将json改为通过http获取到的字符串就可以了。
显示屏部分
屏幕文档介绍
https://heltec.org/project/154-e-ink/ 通信协议:
- 三线spi:CLK+SDI+CS
- DC引脚+BUSY引脚
供电电压:
屏幕分辨率(1.54英寸黑白墨水屏):
屏幕文字图像取模
取模软件:PCtoLCD2002完美版
取模方式
- 取模示例:
如何理解: 每一行代表了像素点的位置,14号字体,宽度14像素,高度14像素,一共14行,每一行是两个8为16进制数,最大可以表示16号字。 若需要表示更大的字,值需要在每一行加一个16进制数即可,依然是每一行表示对应的像素点位置。
{
0x02,0x00,
0x02,0x00,
0x05,0x00,
0x08,0x80,
0x14,0x40,
0x22,0x20,
0xC2,0x18,
0x00,0x00,
0x3F,0xC0,
0x00,0x40,
0x00,0x80,
0x00,0x80,
0x01,0x00,
0x02,0x00},
- 对应程序中的函数:
paint.DrawCharAt(120, 0, ’ '+9, &Fontzh14, COLORED);//今 第一、二个参数是打印位置x,y 第三个参数代表‘ ’字符加上第几个元素,因为函数是从‘ ’开始检索的 第四个参数用来选择字号,需要用对应的font.c文件,还需要再font.h文件中进行结构体声明 第五个参数用来选择打印颜色,colored即为前景色,黑色
此函数与打印ascii码的函数通用,需要显示中文只需要改动对应字库即可
添加字库方法(中文英文通用)
程序总览
- 程序头文件
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include <SPI.h>
#include "epd1in54_V2.h"
#include "epdpaint.h"
#include "imagedata.h"
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
- 程序变量常量定义
#define COLORED 0
#define UNCOLORED 1
int today_tianqi[5][2]={18,20,
17,29,
19,14,
15,16,
13,14};
int yearn,monthn,dayn;
int tianqinum[5]={0,0,0,0,0};
int getxingqi(int years,int months,int day);
String now_address="",now_weather="",now_temperature="",now_temperature_low="",now_day="",now_time="";
String now_address_1="",now_weather_1="",now_temperature_1="",now_temperature_1_low="",now_day_1="";
String now_address_2="",now_weather_2="",now_temperature_2="",now_temperature_2_low="",now_day_2="",now_weather_3="",now_weather_4="";
String GetUrl;
String response;
char* strCat = "";
const char* ssid = "PandoraBox-2.4G-923A97";
const char* password = "790338372";
unsigned char image[1024];
unsigned long time_start_ms;
unsigned long time_now_s;
int today_day=0;
int tianqi_now=0;
HTTPClient http;
HTTPClient https;
Paint paint(image, 0, 0);
Epd epd;
- 初始化函数
void setup() {
get_WIFI();
get_WIFI();
SPI.pins(CLK_PIN,MISO,SDI_PIN,CS_PIN);
SPI.begin();
Serial.begin(115200);
if (epd.Init() != 0)
{
Serial.print("e-Paper init failed");
return;
}
epd.ClearFrameMemory(0xFF);
epd.DisplayFrameFull();
Serial.println("e-Paper SetFrameMemory");
time_start_ms = millis();
}
- 主循环
void loop() {
get_weather();
Serial.println("tianqi:");
Serial.println(tianqinum[0]);
Serial.println(tianqinum[1]);
Serial.println(tianqinum[2]);
Serial.println("now_address:");
Serial.println(now_address);
Serial.println("天气:");
Serial.println(now_weather);
Serial.println("温度:");
Serial.println(now_temperature);
setscreen();
delay(10000);
}
- wifi链接
void get_WIFI()
{
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print("..");
}
Serial.println(" ");
Serial.println("Connected to ");
Serial.println(ssid);
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
- 获取网络天气与时间数据
void get_weather()
{
if (WiFi.status() == WL_CONNECTED) {
http.begin("http://api.seniverse.com/v3/weather/daily.json?key=SCZyJ9BUkrn8BfPpD&location=jinan&language=zh-Hans&unit=c");
int httpget_now = http.GET();
Serial.println("httpget_now:");
Serial.println(httpget_now);
if (httpget_now == HTTP_CODE_OK)
{
Serial.println("that is ok");
String respone = http.getString();
Serial.println(respone);
const size_t capacity = JSON_ARRAY_SIZE(1) + JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(6) + 3*JSON_OBJECT_SIZE(14) + 820;
DynamicJsonBuffer jsonBuffer(capacity);
JsonObject& root = jsonBuffer.parseObject(respone);
JsonObject& results_0 = root["results"][0];
JsonObject& results_0_location = results_0["location"];
const char* results_0_location_id = results_0_location["id"];
const char* results_0_location_name = results_0_location["name"];
const char* results_0_location_country = results_0_location["country"];
const char* results_0_location_path = results_0_location["path"];
const char* results_0_location_timezone = results_0_location["timezone"];
const char* results_0_location_timezone_offset = results_0_location["timezone_offset"];
JsonArray& results_0_daily = results_0["daily"];
JsonObject& results_0_daily_0 = results_0_daily[0];
const char* results_0_daily_0_date = results_0_daily_0["date"];
const char* results_0_daily_0_text_day = results_0_daily_0["text_day"];
const char* results_0_daily_0_code_day = results_0_daily_0["code_day"];
const char* results_0_daily_0_text_night = results_0_daily_0["text_night"];
const char* results_0_daily_0_code_night = results_0_daily_0["code_night"];
const char* results_0_daily_0_high = results_0_daily_0["high"];
const char* results_0_daily_0_low = results_0_daily_0["low"];
const char* results_0_daily_0_rainfall = results_0_daily_0["rainfall"];
const char* results_0_daily_0_precip = results_0_daily_0["precip"];
const char* results_0_daily_0_wind_direction = results_0_daily_0["wind_direction"];
const char* results_0_daily_0_wind_direction_degree = results_0_daily_0["wind_direction_degree"];
const char* results_0_daily_0_wind_speed = results_0_daily_0["wind_speed"];
const char* results_0_daily_0_wind_scale = results_0_daily_0["wind_scale"];
const char* results_0_daily_0_humidity = results_0_daily_0["humidity"];
JsonObject& results_0_daily_1 = results_0_daily[1];
const char* results_0_daily_1_date = results_0_daily_1["date"];
const char* results_0_daily_1_text_day = results_0_daily_1["text_day"];
const char* results_0_daily_1_code_day = results_0_daily_1["code_day"];
const char* results_0_daily_1_text_night = results_0_daily_1["text_night"];
const char* results_0_daily_1_code_night = results_0_daily_1["code_night"];
const char* results_0_daily_1_high = results_0_daily_1["high"];
const char* results_0_daily_1_low = results_0_daily_1["low"];
const char* results_0_daily_1_rainfall = results_0_daily_1["rainfall"];
const char* results_0_daily_1_precip = results_0_daily_1["precip"];
const char* results_0_daily_1_wind_direction = results_0_daily_1["wind_direction"];
const char* results_0_daily_1_wind_direction_degree = results_0_daily_1["wind_direction_degree"];
const char* results_0_daily_1_wind_speed = results_0_daily_1["wind_speed"];
const char* results_0_daily_1_wind_scale = results_0_daily_1["wind_scale"];
const char* results_0_daily_1_humidity = results_0_daily_1["humidity"];
JsonObject& results_0_daily_2 = results_0_daily[2];
const char* results_0_daily_2_date = results_0_daily_2["date"];
const char* results_0_daily_2_text_day = results_0_daily_2["text_day"];
const char* results_0_daily_2_code_day = results_0_daily_2["code_day"];
const char* results_0_daily_2_text_night = results_0_daily_2["text_night"];
const char* results_0_daily_2_code_night = results_0_daily_2["code_night"];
const char* results_0_daily_2_high = results_0_daily_2["high"];
const char* results_0_daily_2_low = results_0_daily_2["low"];
const char* results_0_daily_2_rainfall = results_0_daily_2["rainfall"];
const char* results_0_daily_2_precip = results_0_daily_2["precip"];
const char* results_0_daily_2_wind_direction = results_0_daily_2["wind_direction"];
const char* results_0_daily_2_wind_direction_degree = results_0_daily_2["wind_direction_degree"];
const char* results_0_daily_2_wind_speed = results_0_daily_2["wind_speed"];
const char* results_0_daily_2_wind_scale = results_0_daily_2["wind_scale"];
const char* results_0_daily_2_humidity = results_0_daily_2["humidity"];
const char* results_0_last_update = results_0["last_update"];
now_day=results_0_daily_0_date;
now_address=results_0_location_name;
now_weather=results_0_daily_0_text_day;
now_temperature=results_0_daily_0_high;
now_temperature_low=results_0_daily_0_low;
now_day_1=results_0_daily_1_date;
now_address_1=results_0_location_name;
now_weather_1=results_0_daily_1_text_day;
now_temperature_1=results_0_daily_1_high;
now_temperature_1_low=results_0_daily_1_low;
now_day_2=results_0_daily_2_date;
now_address_2=results_0_location_name;
now_weather_2=results_0_daily_2_text_night;
now_temperature_2=results_0_daily_2_high;
now_temperature_2_low=results_0_daily_2_low;
now_weather_3=results_0_daily_2_text_day;
now_weather_4=results_0_daily_2_text_night;
String str0 = "晴";
String str1 = "阴";
String str2 = "大雨";
String str3 = "多云";
String str4 = "小雨";
if(str0==now_weather)
{
tianqinum[0]=0;
}
else if (str1==now_weather)
{
tianqinum[0]=1;
}
else if (str2==now_weather)
{
tianqinum[0]=2;
}
else if (str3==now_weather)
{
tianqinum[0]=3;
}
else
{
tianqinum[0]=4;
}
if(str0==now_weather_1)
{
tianqinum[1]=0;
}
else if (str1==now_weather_1)
{
tianqinum[1]=1;
}
else if (str2==now_weather_1)
{
tianqinum[1]=2;
}
else if (str3==now_weather_1)
{
tianqinum[1]=3;
}
else
{
tianqinum[1]=4;
}
if(str0==now_weather_2)
{
tianqinum[2]=0;
}
else if (str1==now_weather_2)
{
tianqinum[2]=1;
}
else if (str2==now_weather_2)
{
tianqinum[2]=2;
}
else if (str3==now_weather_2)
{
tianqinum[2]=3;
}
else
{
tianqinum[2]=4;
}
if(str0==now_weather_3)
{
tianqinum[3]=0;
}
else if (str1==now_weather_3)
{
tianqinum[3]=1;
}
else if (str2==now_weather_3)
{
tianqinum[3]=2;
}
else if (str3==now_weather_3)
{
tianqinum[3]=3;
}
else
{
tianqinum[3]=4;
}
if(str0==now_weather_4)
{
tianqinum[4]=0;
}
else if (str1==now_weather_4)
{
tianqinum[4]=1;
}
else if (str2==now_weather_4)
{
tianqinum[4]=2;
}
else if (str3==now_weather_4)
{
tianqinum[4]=3;
}
else
{
tianqinum[4]=4;
}
yearn=(now_day[0]-'0')*1000+(now_day[1]-'0')*100+(now_day[2]-'0')*10+(now_day[3]-'0')*1;
monthn=(now_day[5]-'0')*10+(now_day[6]-'0');
dayn=(now_day[8]-'0')*10+(now_day[9]-'0');
today_day=getxingqi(yearn,monthn,dayn);
http.end();
delay(100);
}
http.end();
https.begin("http://quan.suning.com/getSysTime.do");
int httpCode = https.GET();
if (httpCode > 0)
{
Serial.printf("[HTTP] GET... code: %d\n", httpCode);
if (httpCode == HTTP_CODE_OK)
{
response = https.getString();
Serial.println(response);
const size_t capacitys = JSON_OBJECT_SIZE(2) + 60;
DynamicJsonBuffer jsonBuffers(capacitys);
JsonObject& roots = jsonBuffers.parseObject(response);
const char* sysTime2 = roots["sysTime2"];
const char* sysTime1 = roots["sysTime1"];
now_time=sysTime1;
https.end();
delay(100);
}
}
else
{
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
https.end();
}
}
- 日期转换为星期
int getxingqi(int years,int months,int day)
{
int yd, md;
int dh;
int xin;
int yushu1,yushu2;
yd = ((years%100)/4 + (years%100))%7;
yushu1 = years%4;
yushu2 = years%100;
if(yushu1 = 0 && yushu2 != 0)
{
if(months == 1)
{
md = 5;
}
if(months == 2)
{
md = 1;
}
if(months == 3)
{
md = 2;
}
if(months == 4)
{
md = 5;
}
if(months == 5)
{
md = 0;
}
if(months == 6)
{
md = 3;
}
if(months == 7)
{
md = 5;
}
if(months == 8)
{
md = 1;
}
if(months == 9)
{
md = 4;
}
if(months == 10)
{
md = 6;
}
if(months == 11)
{
md = 2;
}
if(months == 12)
{
md = 4;
}
xin = (day+md+yd)%7;
switch(xin)
{
case 1:return(1);
break;
case 2:return(2);
break;
case 3:return(3);
break;
case 4:return(4);
break;
case 5:return(5);
break;
case 6:return(6);
break;
case 7:return(0);
break;
}
}
else
{
if(months == 1)
{
md = 6;
}
if(months == 2)
{
md = 2;
}
if(months == 3)
{
md = 2;
}
if(months == 4)
{
md = 5;
}
if(months == 5)
{
md = 0;
}
if(months == 6)
{
md = 3;
}
if(months == 7)
{
md = 5;
}
if(months == 8)
{
md = 1;
}
if(months == 9)
{
md = 4;
}
if(months == 10)
{
md = 6;
}
if(months == 11)
{
md = 2;
}
if(months == 12)
{
md = 4;
}
xin = (day+md+yd) % 7;
switch(xin)
{
case 1:return(1);
break;
case 2:return(2);
break;
case 3:return(3);
break;
case 4:return(4);
break;
case 5:return(5);
break;
case 6:return(6);
break;
case 7:return(0);
break;
}
}
return 0;
}
- 屏幕刷新
void setscreen()
{
epd.ClearFrameMemory(0xFF);
epd.DisplayFrameFull();
Serial.println("e-Paper SetFrameMemory");
paint.SetRotate(ROTATE_270);
paint.SetWidth(15);
paint.SetHeight(200);
paint.Clear(UNCOLORED);
strCat="";
sprintf(strCat,"%s %c%c:%c%c",const_cast<char*>(now_day.c_str()),now_time[8],now_time[9],now_time[10],now_time[11]);
paint.DrawStringAt(0, 2, strCat, &Font12, COLORED);
epd.SetFrameMemory(paint.GetImage(), 0, 0, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
strCat="";
paint.DrawFilledRectangle(0, 0, 200, 0, COLORED);
sprintf(strCat,"%c%c-%c%c %c%c-%c%c %c%c-%c%c %c%c-%c%c%c%c-%c%c"
,monthn/10+'0',monthn%10+'0',dayn/10+'0',dayn%10+'0'
,monthn/10+'0',monthn%10+'0',(dayn+1)/10+'0',(dayn+1)%10+'0'
,monthn/10+'0',monthn%10+'0',(dayn+2)/10+'0',(dayn+2)%10+'0'
,monthn/10+'0',monthn%10+'0',(dayn+3)/10+'0',(dayn+3)%10+'0'
,monthn/10+'0',monthn%10+'0',(dayn+4)/10+'0',(dayn+4)%10+'0');
paint.DrawStringAt(0, 2, strCat, &Font12, COLORED);
epd.SetFrameMemory(paint.GetImage(), 102, 0, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
strCat="";
paint.DrawFilledRectangle(0, 15, 200, 15, COLORED);
sprintf(strCat," %s. %s. %s. %s. %s. ",
const_cast<char*>(now_temperature.c_str()),
const_cast<char*>(now_temperature_1.c_str()),
const_cast<char*>(now_temperature_2.c_str()),
const_cast<char*>(now_temperature_1_low.c_str()),
const_cast<char*>(now_temperature_low.c_str()));
paint.DrawStringAt(0, 2, strCat, &Font12, COLORED);
epd.SetFrameMemory(paint.GetImage(), 141, 0, paint.GetWidth(), paint.GetHeight());
paint.SetWidth(15);
paint.SetHeight(200);
paint.Clear(UNCOLORED);
paint.DrawCharAt(0, 0, ' '+11, &Fontzh14, COLORED);
paint.DrawCharAt(15, 0, ' '+12, &Fontzh14, COLORED);
paint.DrawCharAt(120, 0, ' '+9, &Fontzh14, COLORED);
paint.DrawCharAt(135, 0, ' '+10, &Fontzh14, COLORED);
paint.DrawCharAt(155, 0, ' '+7, &Fontzh14, COLORED);
paint.DrawCharAt(169, 0, ' '+8, &Fontzh14, COLORED);
paint.DrawCharAt(184, 0, ' '+today_day, &Fontzh14, COLORED);
epd.SetFrameMemory(paint.GetImage(), 81, 0, paint.GetWidth(), paint.GetHeight());
paint.SetWidth(22);
paint.SetHeight(200);
paint.Clear(UNCOLORED);
paint.DrawCharAt(9, 0, ' '+tianqinum[0], &FontTQ, COLORED);
paint.DrawCharAt(49, 0, ' '+tianqinum[1], &FontTQ, COLORED);
paint.DrawCharAt(89, 0, ' '+tianqinum[2], &FontTQ, COLORED);
paint.DrawCharAt(129, 0, ' '+tianqinum[3], &FontTQ, COLORED);
paint.DrawCharAt(169, 0, ' '+tianqinum[4], &FontTQ, COLORED);
epd.SetFrameMemory(paint.GetImage(), 118, 0, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
paint.DrawCharAt(0, 2, ' '+7, &Fontzh14, COLORED);
paint.DrawCharAt(15, 2, ' '+8, &Fontzh14, COLORED);
paint.DrawCharAt(30, 2, ' '+((today_day+1)%7), &Fontzh14, COLORED);
paint.DrawCharAt(89, 0, ' '+tianqinum[1], &FontTQ, COLORED);
strCat="";
sprintf(strCat,"%s.~%s.",const_cast<char*>(now_temperature_1_low.c_str()),const_cast<char*>(now_temperature_1.c_str()));
paint.DrawStringAt(120, 2, strCat, &Font16, COLORED);
epd.SetFrameMemory(paint.GetImage(), 157, 0, paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED);
paint.DrawCharAt(0, 2, ' '+7, &Fontzh14, COLORED);
paint.DrawCharAt(15, 2, ' '+8, &Fontzh14, COLORED);
paint.DrawCharAt(30, 2, ' '+((today_day+2)%7), &Fontzh14, COLORED);
paint.DrawCharAt(89, 0, ' '+tianqinum[2], &FontTQ, COLORED);
strCat="";
sprintf(strCat,"%s.~%s.",const_cast<char*>(now_temperature_2_low.c_str()),const_cast<char*>(now_temperature_2.c_str()));
paint.DrawStringAt(120, 2, strCat, &Font16, COLORED);
epd.SetFrameMemory(paint.GetImage(), 178, 0, paint.GetWidth(), paint.GetHeight());
paint.SetWidth(64);
paint.SetHeight(100);
paint.Clear(UNCOLORED);
paint.DrawCharAt(0, 0, now_temperature[0]+' '-'0', &Font64, COLORED);
paint.DrawCharAt(34, 0, now_temperature[1]+' '-'0', &Font64, COLORED);
paint.DrawCharAt(66, 0, ' '+10, &Font64, COLORED);
paint.DrawFilledRectangle(99, 0, 99, 64, COLORED);
epd.SetFrameMemory(paint.GetImage(), 18, 85, paint.GetWidth(), paint.GetHeight());
paint.SetWidth(64);
paint.SetHeight(80);
paint.Clear(UNCOLORED);
paint.DrawCharAt(25, 3, ' '+tianqinum[0], &FontTQ, COLORED);
paint.DrawCharAt(25, 28, ' '+today_tianqi[tianqinum[0]][0], &Fontzh14, COLORED);
paint.DrawCharAt(40, 28, ' '+today_tianqi[tianqinum[0]][1], &Fontzh14, COLORED);
strCat="";
sprintf(strCat,"%s.~%s.",const_cast<char*>(now_temperature_low.c_str()),const_cast<char*>(now_temperature.c_str()));
paint.DrawStringAt(15, 50, strCat, &Font12, COLORED);
epd.SetFrameMemory(paint.GetImage(), 18, 0, paint.GetWidth(), paint.GetHeight());
epd.DisplayFrameFull();
}
void setup() {
get_WIFI();
get_WIFI();
SPI.pins(CLK_PIN,MISO,SDI_PIN,CS_PIN);
SPI.begin();
Serial.begin(115200);
if (epd.Init() != 0)
{
Serial.print("e-Paper init failed");
return;
}
epd.ClearFrameMemory(0xFF);
epd.DisplayFrameFull();
Serial.println("e-Paper SetFrameMemory");
time_start_ms = millis();
}
完整工程下载地址
https://download.csdn.net/download/qq_39541326/21090151?spm=1001.2014.3001.5503
|