Skip to content

Commit b8b5cac

Browse files
committed
Align the clock updates to the 0th-second each minute
1 parent 159d09e commit b8b5cac

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

esp8266-clockradio.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,13 @@ void loop() {
173173

174174
ht.sendLed();
175175

176-
delay(60000);
177-
localSeconds += 60;
176+
uint8_t delaySeconds = 60 - seconds;
177+
Serial.print("Sleeping for ");
178+
Serial.print(delaySeconds);
179+
Serial.println(" seconds.");
180+
181+
delay(delaySeconds * 1000);
182+
localSeconds += delaySeconds;
178183
}
179184

180185
// send an NTP request to the time server at the given address

0 commit comments

Comments
 (0)