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: HCSR04new SSH1106-alan
rtc.cpp
00001 #include "mbed.h" 00002 #include "platform/mbed_thread.h" 00003 #include "Thread_Handle.h" 00004 #include "HCSR04.h" 00005 #include "main.h" 00006 #include "handleTasks.h" 00007 00008 struct tm st_tmp; 00009 struct tm *p_tm; 00010 time_t seconds; 00011 void RTC_INIT() 00012 { 00013 st_tmp.tm_year = 2021-1900; 00014 st_tmp.tm_mon = 4; 00015 st_tmp.tm_mday = 8; 00016 st_tmp.tm_hour = 12; 00017 st_tmp.tm_min = 00; 00018 st_tmp.tm_sec = 00; 00019 00020 seconds = mktime(&st_tmp); 00021 set_time(seconds); 00022 } 00023 00024 //display time printf 00025 void RTC_display () 00026 { 00027 seconds = time(NULL); 00028 p_tm = localtime(&seconds); 00029 //Display format year-month-day hour:min:sec 00030 //printf("%04d-%02d-%04d %02d:%02d:%02d \n\n", p_tm->tm_year + 1900,p_tm->tm_mon,p_tm->tm_mday, p_tm->tm_hour, p_tm->tm_min, p_tm->tm_sec); 00031 00032 }
Generated on Wed Jul 27 2022 08:19:38 by
