Use the in built C time.h library to power a clock and output on dispBoB
Dependencies: dispBoB mbed PCA9635
Revision 1:fa8d0331a3cc, committed 2011-07-08
- Comitter:
- d_worrall
- Date:
- Fri Jul 08 14:50:50 2011 +0000
- Parent:
- 0:0b0043f97268
- Child:
- 2:354aed06a948
- Commit message:
- version1
Changed in this revision
main.cpp | Show diff for this revision Revisions of this file |
simpleClock.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Jul 08 14:21:02 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "mbed.h" -#include "dispBoB.h" - -dispBoB db(p28, p27, p26); //instantiate dispBoB object - -int main() { - set_time(1309776930); //set UNIX timestamp - it's Mon, 04 Jul 2011 10:55:30 GMT where I am - - while(1){ //loop forever - time_t rawtime = time(NULL); //update to instantaneous time - - char buffer[32]; //create a local char array object called buffer - strftime(buffer, 32, "%H.%M.%S\n", localtime(&rawtime)); //store string formatted time - - db.locate(0); //position cursor to initial position on screen - db.printf("%s", buffer); //print buffer to dispBoB - } -} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simpleClock.cpp Fri Jul 08 14:50:50 2011 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "dispBoB.h" + +dispBoB db(p28, p27, p26); //instantiate dispBoB object + +int main() { + set_time(1309776930); //set UNIX timestamp - it's Mon, 04 Jul 2011 10:55:30 GMT where I am + + while(1){ //loop forever + time_t rawtime = time(NULL); //update to instantaneous time + + char buffer[32]; //create a local char array object called buffer + strftime(buffer, 32, "%H.%M.%S\n", localtime(&rawtime)); //store string formatted time + + db.locate(0); //position cursor to initial position on screen + db.printf("%s", buffer); //print buffer to dispBoB + } +} \ No newline at end of file