Mod10 Counter Counts 0 - 9 on Single Seven Segment Display

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Eduvance
Date:
Tue May 27 07:13:42 2014 +0000
Parent:
0:375418015e74
Commit message:
A

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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) ;
+
 }
+}