I am working with this tutorial https://www.arduino.cc/en/Tutorial/WiFiRTC but when I upload it it gets stuck in this loop:
unsigned long epoch;
int numberOfTries = 0, maxTries = 6;
do {
epoch = readLinuxEpochUsingNTP();
numberOfTries++;
}
while ((epoch == 0) || (numberOfTries > maxTries));
if (numberOfTries > maxTries) {
Serial.print("NTP unreachable!!");
while (1);
}
else {
Serial.print("Epoch received: ");
Serial.println(epoch);
rtc.setEpoch(epoch);
Serial.println();
}
And it loops more than 6 times, it loops infinitely. And I am sure that it is connected to a Wifi network with internet access. Is there a problem with this tutorial?