|
Blinker lib dev3.0分支支持2.7.1 package,用Blinker.setTimezone(8.0)获取网络时间会导致重启,现象为开机后获取网络时间后,过几十秒到几分钟会导致ESP8266重启,串口调试可以看到获取网络成功并且时区为东八区北京时间,也试过把所有无关blinker的头文件和所有无关代码去掉,只保留Blinker.setTimezone(8.0)也会导致重启,也试过blinker 的获取网络时间的案例也会导致重启。
示例代码如下:
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
BLINKER_LOG("Now second: ", Blinker.second());
BLINKER_LOG("Now minute: ", Blinker.minute());
BLINKER_LOG("Now hour: ", Blinker.hour());
BLINKER_LOG("Now wday: ", Blinker.wday());
BLINKER_LOG("Now month: ", Blinker.month());
BLINKER_LOG("Now mday: ", Blinker.mday());
BLINKER_LOG("Now year: ", Blinker.year());
BLINKER_LOG("Now yday: ", Blinker.yday());
BLINKER_LOG("Now ntp time: ", Blinker.time());
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Blinker.setTimezone(8.0);
}
void loop()
{
Blinker.run();
}
|
|