OK, thanks!
I have now tried to use the NtpClientLib library according to the example.
But now I am stuck at this in the ino file:
void processSyncEvent (NTPSyncEvent_t ntpEvent) {
if (ntpEvent) {
SerialDebug.print ("Time Sync error: ");
if (ntpEvent == noResponse)
SerialDebug.println ("NTP server not reachable");
else if (ntpEvent == invalidAddress)
SerialDebug.println ("Invalid NTP server address");
} else {
SerialDebug.print ("Got NTP time: ");
SerialDebug.println (NTP.getTimeDateString (NTP.getLastNTPSync ()));
}
}
I get errors as follows: Type '' could not be resolved for these identifiers:
NTPSyncEvent_t
noResponse
invalidAddress
NTP
getTimeDateString
getLastNTPSync
But I have set the #include as follows:
/* The NTP time retrieval needs this: */
#include <TimeLib.h>
#include "NtpClientLib.h"
I copied in the two NtpClientLib files downloaded from GIT into the main project dir, hence the "" rather than <>.
Why can't it resolve these identifiers?
Will it matter if I don't include the function void processSyncEvent (NTPSyncEvent_t ntpEvent) ?
Note that in Sloeber IDE if I right-click the NTPSyncEvent_t word and select "Open declaration" it jumps to the location inside the NtpClientLib.h file where it is declared. So Eclipse can find it in that case....