Mod10 Counter Counts 0 - 9 on Single Seven Segment Display

Dependencies:   mbed

main.cpp

Committer:
Eduvance
Date:
2014-05-27
Revision:
1:cecfed677a08
Parent:
0:375418015e74

File content as of revision 1:cecfed677a08:

#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;
//}

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();

//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) ;

}
}