Closed viniciusov closed 5 years ago
I believe it happens because the library is asynchronous, i.e. first time you call it to initiate a request and as it takes some time to receive a reply, when the function returns there's no reply received yet, so you have to wait some time and repeat. This is why it says you should check if dateTime.valid
is true.
while (!dateTime.valid) {}
will wait forever, so enphasis on repeat (call getNTPtime each time you test .valid)
@laurentopia , you should call NTPch.getNTPtime()
inside your while loop. Otherwise it will never get another time and dateTime.valid
will continue with the same state (False) forever.
Hello,
First of all, I would like to congratulate the author for this nice work. The library seems so easy to use and it has been so useful to me.
But I'm experience a little issue here. I'm using a ESP8266 board and a code very similar to your example but when I turn on the chip e run the code it ALWAYS fails on the first attempt to get a valid time. (More especifically, 'dateTime.valid' is not valid). After that, the library seems to work correctly and the code can get a valid time.
Can you help me with this issue?