Post topics, source code that relate to the Arduino Platform

User avatar
By tgibbs99
#13479 Slartibartfast,

Your sketch is closest I've seen to what I'm looking for.

Just to make the request explicit:

I'm hoping someone can point me to a sketch, in Arduino IDE, that uses esp8266 to obtain NTP time.

Thanks all!

Tim
User avatar
By ricg
#13608 Slartibartfast, that was not garbage being returned. It was the ntp packet from the time server.
i used your code plus the ntp packet conversion routine from the example you had found, added code to capture the recv'd data and then made your code call the ntp server every 15s.
Output now looks like this:
AT+CIPSEND=48

> Seconds since Jan 1 1900 = 3637281585
Unix time = 1428292785
The UTC time is 3:59:45
AT+CIPSEND=48

OK

SEND OK
AT+CIPSEND=48

> Seconds since Jan 1 1900 = 3637281606
Unix time = 1428292806
The UTC time is 4:00:06
----------------------------------------------
See attachment ntp.c
You do not have the required permissions to view the files attached to this post.
Last edited by ricg on Tue May 05, 2015 12:22 am, edited 1 time in total.
User avatar
By tgibbs99
#13653 Slartibartfast and Byricg'

Thank you! Thank you! Thank you!

This code works!

I was also able, today, to finally flash to firmware version 002000902_NTP, and that allows direct query of NTP time using commands
AT+CIPNTP=(GMT offset)
and
AT+CIPNTP?

So I have two ways to do it!!!!

Thanks again.

Tim
User avatar
By antinym
#17912 The ntp.c works great, but I can't figure out how to run it as a subroutine. I only need to set the time once.