NTPClient
NTPClient copied to clipboard
Void loop() Reconnection features in the example
the example is missing these lines of codes to ensure the packets are sent/received, in case the access point is disabled:
void loop() {
if(WiFi.status() != WL_CONNECTED)
{
Serial.print("WiFi connection lost");
WiFi.begin(ssid,password); //for ESP32 the reconnect function is not as good as a WiFi.begin() !
while(WiFi.status() != WL_CONNECTED){
delay(1000);
Serial.print(".");
}
Serial.println("\nWiFi reconnected");
}
timeClient.update();
Serial.println(timeClient.getFormattedTime());
delay(1000);
}