Eduvance vanmat / Mbed 2 deprecated 02SegCounter0_9

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"// select multiplexed seven segment display on remote lab
00002 BusOut Disp1(p26,p25,p24,p23,p22,p21,p20); // ABCDEFGdp
00003 DigitalOut vdd1(p19); 
00004 DigitalOut vdd2(p18); 
00005 //void setvdd1() {
00006 //  vdd1=1; 
00007 //   vdd2=0;
00008 //}
00009 
00010 void setvdd2() {
00011  //  vdd1=0;
00012     vdd2=1;// to activate 1st seven segment display p18
00013    vdd1=0;// to deactivate 2nd seven segment display and vice versa p19
00014 }
00015 
00016 int main() 
00017 {
00018 while (1) 
00019 { //setvdd1();
00020 
00021 //Disp1 = 0xC0; wait(0.9) ;
00022 //Disp1 = 0xF9; wait(0.9) ;
00023 //Disp1 = 0xA4; wait(0.9) ;
00024 //Disp1 = 0xB0; wait(0.9) ;
00025 //Disp1 = 0x99; wait(0.9) ;
00026 //Disp1 = 0x92; wait(0.9);
00027 //Disp1 = 0x82; wait(0.9);
00028 //Disp1 = 0xF8; wait(0.9);
00029 //Disp1 = 0x80; wait(0.9);
00030 //Disp1 = 0x90; wait(0.9) ;
00031 
00032 setvdd2();
00033 
00034 Disp1 = 0xC0; wait(0.9) ;
00035 Disp1 = 0xF9; wait(0.9) ;
00036 Disp1 = 0xA4; wait(0.9) ;
00037 Disp1 = 0xB0; wait(0.9) ;
00038 Disp1 = 0x99; wait(0.9) ;
00039 Disp1 = 0x92; wait(0.9);
00040 Disp1 = 0x82; wait(0.9);
00041 Disp1 = 0xF8; wait(0.9);
00042 Disp1 = 0x80; wait(0.9);
00043 Disp1 = 0x90; wait(0.9) ;
00044 
00045 }
00046 }