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.
Dependencies: NTPClient kt_vfd_20170703
Fork of NTPClient_example by
main.cpp
00001 #include "mbed.h" 00002 #include "NTPClient.h" 00003 #include "EthernetInterface.h" 00004 #include "kt_vfd.h" 00005 00006 // GU140X16G-7040 00007 KT_VFD vfd(p15, p16, p17, p18, p19, p20, p21, p22, p23, p24) ; 00008 00009 int main() 00010 { 00011 EthernetInterface eth ; 00012 00013 vfd.printf("Setting up...\n") ; 00014 int ethError = eth.connect() ; 00015 00016 if(ethError != 0) { 00017 vfd.printf("Connect failed (%d)", ethError) ; 00018 eth.disconnect() ; 00019 return 0 ; 00020 } 00021 00022 NTPClient ntp(eth) ; 00023 vfd.cls() ; 00024 vfd.printf("Connect success\n", ethError) ; 00025 vfd.printf("IP: %s", eth.get_ip_address()) ; 00026 time_t ctTime ; 00027 wait(5) ; 00028 vfd.cls() ; 00029 while(1) { 00030 ntp.setTime("ntp.nict.jp") ; 00031 ctTime = time(NULL) + (60 * 60 * 9) ; // JST 00032 char buffer[64] ; 00033 strftime(buffer, 64, " %a %d %b %Y\n %H:%M:%S (JST)", localtime(&ctTime)) ; 00034 vfd.printf("%s\n", buffer) ; 00035 } 00036 }
Generated on Tue Jul 19 2022 19:55:46 by
1.7.2
