Eduvance vanmat
/
02SegCounter0_9
Mod10 Counter Counts 0 - 9 on Single Seven Segment Display
Diff: main.cpp
- Revision:
- 1:cecfed677a08
- Parent:
- 0:375418015e74
diff -r 375418015e74 -r cecfed677a08 main.cpp --- a/main.cpp Sat May 17 16:17:55 2014 +0000 +++ b/main.cpp Tue May 27 07:13:42 2014 +0000 @@ -1,12 +1,46 @@ -#include "mbed.h" +#include "mbed.h"// select multiplexed seven segment display on remote lab +BusOut Disp1(p26,p25,p24,p23,p22,p21,p20); // ABCDEFGdp +DigitalOut vdd1(p19); +DigitalOut vdd2(p18); +//void setvdd1() { +// vdd1=1; +// vdd2=0; +//} -DigitalOut myled(LED1); +void setvdd2() { + // vdd1=0; + vdd2=1;// to activate 1st seven segment display p18 + vdd1=0;// to deactivate 2nd seven segment display and vice versa p19 +} + +int main() +{ +while (1) +{ //setvdd1(); -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } +//Disp1 = 0xC0; wait(0.9) ; +//Disp1 = 0xF9; wait(0.9) ; +//Disp1 = 0xA4; wait(0.9) ; +//Disp1 = 0xB0; wait(0.9) ; +//Disp1 = 0x99; wait(0.9) ; +//Disp1 = 0x92; wait(0.9); +//Disp1 = 0x82; wait(0.9); +//Disp1 = 0xF8; wait(0.9); +//Disp1 = 0x80; wait(0.9); +//Disp1 = 0x90; wait(0.9) ; + +setvdd2(); + +Disp1 = 0xC0; wait(0.9) ; +Disp1 = 0xF9; wait(0.9) ; +Disp1 = 0xA4; wait(0.9) ; +Disp1 = 0xB0; wait(0.9) ; +Disp1 = 0x99; wait(0.9) ; +Disp1 = 0x92; wait(0.9); +Disp1 = 0x82; wait(0.9); +Disp1 = 0xF8; wait(0.9); +Disp1 = 0x80; wait(0.9); +Disp1 = 0x90; wait(0.9) ; + } +}