Hiroshi M
/
My7SEG_test
Orignal AVR Tiny USI Based I2C slave Charlieplexing 7SEG Test Program.
Revision 0:f3babdc5d382, committed 2013-12-12
- Comitter:
- bant62
- Date:
- Thu Dec 12 01:52:00 2013 +0000
- Commit message:
- Orignal AVR Tiny USI Based I2C slave Charlieplexing 7SEG LED Test Program.
Changed in this revision
diff -r 000000000000 -r f3babdc5d382 My7SEG.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/My7SEG.lib Thu Dec 12 01:52:00 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/bant62/code/My7SEG/#e7362bcb9e1f
diff -r 000000000000 -r f3babdc5d382 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 12 01:52:00 2013 +0000 @@ -0,0 +1,43 @@ +#include "mbed.h" +#include "My7SEG.h" + +I2C i2c(dp5,dp27); // sda, scl +My7SEG _7seg(&i2c); +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +int main() +{ + int hour,min,sec; + char buf[9]; + + hour = 0; + min = 0; + sec = 0; + led1 = 1; + led2 = 0; + while(1) { + sprintf(buf,"%02d.%02d.%02d",hour,min,sec); + _7seg.clear(); + _7seg.printStr(buf); + led1 = !led1; + led2 = !led2; + + sec++; + if (sec > 59) { + sec = 0; + min++; + } + + if (min > 59) { + min = 0; + hour++; + } + + if (hour > 23) { + hour = 0; + } + + wait(1); + } +}
diff -r 000000000000 -r f3babdc5d382 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 12 01:52:00 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file