Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "NTPClient.h" 00003 #include "EthernetInterface.h" 00004 00005 int main() { 00006 00007 EthernetInterface eth; 00008 00009 printf("Setting up...\n"); 00010 00011 int ethError = eth.connect(); 00012 00013 if(ethError == 0) 00014 { 00015 NTPClient ntp(eth); 00016 printf("ETH is up : %s\n", eth.get_ip_address()); 00017 time_t ctTime; 00018 ctTime = time(NULL); 00019 printf("Current time is (UTC): %s\n", ctime(&ctTime)); 00020 00021 ntp.setTime("0.uk.pool.ntp.org"); 00022 00023 ctTime = time(NULL); 00024 printf("\nTime is now (UTC): %s\n", ctime(&ctTime)); 00025 00026 eth.disconnect(); 00027 } else { 00028 printf("Connect failed (%d)", ethError); 00029 } 00030 00031 return 0; 00032 00033 }
Generated on Sun Jul 17 2022 15:48:58 by
1.7.2