-
• #2
But, if I press reset button on the board, it set time to 01.01.1970.
Normal, because there is no real time clock (RTC).
Try it this way:
- connect to the wifi access point (AP)
- call setSNTP(your options)
- connect to the wifi access point (AP)
-
• #3
Hi MaBe, thank you for your answer.
That is the tricky part, if i use setSntp, I am getting error :Uncaught Error: Cannot read property 'connect' of undefined
at line 57 col 5
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {Any idea why is this happening?
Thanks 😊
-
• #4
have a look at the first sample on Reference#Wifi
-
• #5
check the EspruinoESP8266 page too
I am trying to sync my esp8266 with NTP server, but I am running into a two problems.
The first one is that if I use setSNTP(sntpServer, timeOffset) method on require("Wifi")
I am getting error msg:
The second problem:
If I ditch the idea of using SNTP and just use Date(), when esp is connected I print time and it sometimes shows my local time, and sometimes UTC time. But, if I press reset button on the board, it set time to 01.01.1970.
What am I missing here?
Here is my code:
Thanks :)