-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathntp.ino
31 lines (29 loc) · 883 Bytes
/
ntp.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Temperature, Humidity and Air Quality
// with WeMOS D1 mini lite
// DHT11/21/22
// MQ135
//
// Written by Michele <o-zone@zerozone.it> Pinassi
// Released under GPLv3 - No any warranty
#include <NtpClientLib.h>
// ************************************
// processSyncEvent()
//
// manage NTP sync events and warn in case of error
// ************************************
void processSyncEvent(NTPSyncEvent_t ntpEvent) {
DEBUG("[DEBUG] processSyncEvent() ");
if (ntpEvent) {
Serial.print ("[ERROR] Time Sync error: ");
if (ntpEvent == noResponse)
Serial.println ("[ERROR] NTP server not reachable");
else if (ntpEvent == invalidAddress)
Serial.println ("[ERROR] Invalid NTP server address");
} else {
#ifdef __DEBUG__
Serial.print("[DEBUG] Got NTP time: ");
Serial.println(NTP.getTimeDateString (NTP.getLastNTPSync ()));
#endif
}
}