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.
Diff: Function2.h
- Revision:
- 0:52fb551ac065
- Child:
- 1:80aea0f0fcbd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Function2.h Thu Jan 22 01:06:03 2015 +0000 @@ -0,0 +1,88 @@ +/* + Function 2: take the hour and minute, display the hour and minute in the format + of HH:MM on the 4-bank seven segment LED display for 1 minute with the: blinking + every second (On for half second and Off for half second 1/2s = 500ms) + + */ + +void digitalClock () +{ + + int numbers [10] = { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x98 }; + int numbers2 [10] = { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x98 }; + int numbers3 [10] = { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x98 }; + int numbers4 [10] = { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x98 }; + + +int a = 0; +int b = 0; +int c = 0; +int d = 0; + +while(1){ + + if ( b == 6 ) + { + + b = 0; + c = c +1; + } + + for ( int i = 0; i < 2; i++ ) //3000 interations = 60s + { + + digselect = 0x1; // digit 1 Binary: 0 0 0 1 + digit = numbers4[d]; + wait_ms(3); + + digselect = 0x2; //digit 2 Binary: 0 0 1 0 + digit = numbers2[c]; + wait_ms(3); + + digselect = 0x4; //digit 3 Binary: 0 1 0 0 + digit = numbers3[b]; + wait_ms(3); + + digselect = 0x8; //digit 4 Binary: 1 0 0 0 + digit = numbers[a]; + wait_ms(3); + + digselect = 0x10; // position 1 0 0 0 0 + L1 = 1; + wait_ms(3); + + digselect = 0x8; + digit00(); + wait_ms(5); + + wait_ms(4); + + + }; + + a++; + if (( d == 2 ) && ( c == 4) ) + { + a = 0; + b = 0; + c = 0; + d = 0; + } + + if ( a == 10) + { + a = 0; + b = b + 1; + + }; + if ( c == 10 ) + { + c = 0; + d = d + 1; + } + + + + }; + +};// end of Function