
Simple program to access time from mbed's internal RTC Battery needs to be connected to specified pins on manual
main.cpp
- Committer:
- kuldipmaharjan
- Date:
- 2014-01-08
- Revision:
- 0:3bcda94a334a
File content as of revision 0:3bcda94a334a:
//Author: Kuldip Maharjan //Email : kuldipmaharjan@gmail.com //Anyone can use this code if it helps in their projects or //for learning programing in mbed besides for commercial purposes //Simple program to access time from mbed's internal RTC //Battery needs to be connected to specified pins on manual #include "mbed.h" Serial pc(p9, p10); // tx, rx int main() { pc.baud(115200); set_time(1361223433); // http://www.epochconverter.com/ while (true) { time_t seconds = time(NULL); pc.printf("Time as a basic string = %s \n", ctime(&seconds)); //char buffer[32]; // strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); //pc.printf("Time as a custom formatted string = %s", buffer); wait(1); } }