Go Down

Topic: Wifi RTC not working (Read 1 time) previous topic - next topic


I am working with this tutorial https://www.arduino.cc/en/Tutorial/WiFiRTC but when I upload it it gets stuck in this loop:
Code: [Select]
unsigned long epoch;
  int numberOfTries = 0, maxTries = 6;
  do {
    epoch = readLinuxEpochUsingNTP();
  while ((epoch == 0) || (numberOfTries > maxTries));

  if (numberOfTries > maxTries) {
    Serial.print("NTP unreachable!!");
    while (1);
  else {
    Serial.print("Epoch received: ");


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?


Jul 21, 2016, 02:43 am Last Edit: Jul 21, 2016, 02:44 am by Ballscrewbob
Compiles and runs fine here directly from the tutorial.

Did you change any of the code (apart from ssid and password) ?
Does it fail right away or after a while ?

If its after a while you are subject the a known MKR bug that seems linked to the serial output and as yet I have not found a cure despite a lot of testing.

The other thing maybe a firewall / port issue at your end either in house or at your ISP seeing as you seem to be hitting the max re-tries ?

Win 7 X64 here btw working with or without VPN connection

How did you isolate the specific section of code  as the issue ?
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google (who would have thunk it ! ) or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.


Go Up