Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By hugch
#26577 Hi all,

here is a sample sketch to update the DS3231 RTC shield with NTP Timestamp.

The sketch use not the RTC library from the Arduino ESP reference page, but in the git repository is a lib available.

The NTP stuff comes from the NTPUpdate example with some modifications and a simple user time zone selection.
Please take a look and post a comment if you are like it or not. :)

Regards,
Kalle
User avatar
By bobcroft
#37091 Kalle, as others have noted a nice coding style. I have used a slightly modified version of your code on an ESP8266-12E and it works perfectly. However I have one issue and that is that the RTC module does not maintain the time when I turn the power off. It has a battery back up and I'll check the battery but I am baffled why the RTC doesn't retain the correct time.
I was also trying to use the time library and I coded time_t t = epoch; the sketch compiled but I am not certain if that code is correct to put the time into the Time library format. Do you know if that last bit of code is correct.

Thank you.