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.
main.cpp
00001 #include "mbed.h" 00002 #include "My7SEG.h" 00003 00004 I2C i2c(dp5,dp27); // sda, scl 00005 My7SEG _7seg(&i2c); 00006 DigitalOut led1(LED1); 00007 DigitalOut led2(LED2); 00008 00009 int main() 00010 { 00011 int hour,min,sec; 00012 char buf[9]; 00013 00014 hour = 0; 00015 min = 0; 00016 sec = 0; 00017 led1 = 1; 00018 led2 = 0; 00019 while(1) { 00020 sprintf(buf,"%02d.%02d.%02d",hour,min,sec); 00021 _7seg.clear(); 00022 _7seg.printStr(buf); 00023 led1 = !led1; 00024 led2 = !led2; 00025 00026 sec++; 00027 if (sec > 59) { 00028 sec = 0; 00029 min++; 00030 } 00031 00032 if (min > 59) { 00033 min = 0; 00034 hour++; 00035 } 00036 00037 if (hour > 23) { 00038 hour = 0; 00039 } 00040 00041 wait(1); 00042 } 00043 }
Generated on Sun Jul 17 2022 18:58:44 by
1.7.2