NTP client app setting system time and X-NUCLEO-IDW01M1 Wi-Fi board time connecting to internet NTP UTC time server.
Dependencies: NTPClient NetworkSocketAPI X_NUCLEO_IDW01M1v2 mbed
Fork of NTPClient_HelloWorld by
Example of retrieval of current time using an NTP server.
Time is then used to perform a TLS secure connection to https://mbed.org.
The application is meant to be used with mbed OS 2 ("Classic") only (no mbedOS 5 support).
Diff: main.cpp
- Revision:
- 1:d263603373ac
- Parent:
- 0:0e0debc29569
- Child:
- 2:bf7dc5f5bca9
--- a/main.cpp Fri Jun 29 11:07:21 2012 +0000 +++ b/main.cpp Sun Aug 05 16:12:30 2012 +0000 @@ -2,16 +2,17 @@ #include "EthernetInterface.h" #include "HTTPClient.h" +EthernetInterface eth; +HTTPClient http; +char str[512]; + int main() { - EthernetInterface eth; eth.init(); //Use DHCP eth.connect(); //GET data - HTTPClient http; - char str[512]; printf("Trying to fetch page...\n"); int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128); if (!ret) @@ -23,7 +24,7 @@ { printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } - + //POST data HTTPMap map; HTTPText text(str, 512);