a
Dependencies: CheckRTC mbed mbed
main.cpp
- Committer:
- jhon309
- Date:
- 2015-08-13
- Revision:
- 0:e99d6df2cc36
File content as of revision 0:e99d6df2cc36:
/// Include --------------------------------------------------------------------------------------- #include "mbed.h" #include "CheckRTC.h" // Object ---------------------------------------------------------------------------------------- Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled1(LED1); // Assign LED1 output port // Function prototypes --------------------------------------------------------------------------- // Definition ------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------- // Control Program //------------------------------------------------------------------------------------------------- int main() { time_t seconds; char buf[64]; struct tm t; t.tm_year = 15 + 100; t.tm_mon = 7 - 1; t.tm_mday = 29; t.tm_hour = 23; t.tm_min = 57; t.tm_sec = 00; seconds = mktime(&t); set_time(seconds); for (;;) { seconds = time(NULL); strftime(buf,40, "%I:%M:%S %p (%Y/%m/%d)", localtime(&seconds)); wait(1); myled1 =! myled1; pc.printf("%s\r\n",buf); } }