NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Void loop() Reconnection features in the example

Open sylvanoMTL opened this issue 4 years ago • 0 comments

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);
}

sylvanoMTL avatar Jan 03 '21 12:01 sylvanoMTL