Jim Cordwell / Mbed 2 deprecated Segments_01_Simple

Dependencies:   mbed

Revision:
3:6b50a41e54f3
Parent:
2:91808e29f193
Child:
4:84ce87a4a8e8
diff -r 91808e29f193 -r 6b50a41e54f3 main.cpp
--- a/main.cpp	Sat May 24 09:33:29 2014 +0000
+++ b/main.cpp	Sat May 24 11:33:36 2014 +0000
@@ -43,8 +43,7 @@
     //Set desired LED to update
     com = led;
     
-    //Update it in a loop otherwise it's too fast
-    //and the display blurs across the LEDs
+    //Update it in a loop to the desired values
     for(uint8_t i = 0; i < 100; i++) 
     {
         seg_a = 1 - a; //setting a segment to 1 means off 
@@ -56,6 +55,10 @@
         seg_g = 1 - g;
         seg_p = 1 - p;
     }
+    
+    //Finally switch off all segments again, we must do this otherwise when
+    //switching com the segments will momentarily duplicated from this led.
+    seg_a = seg_b = seg_c = seg_d = seg_e = seg_f = seg_g = seg_p = 1;
 }
 
 /******************************************************
@@ -65,6 +68,7 @@
 {
     for(;;) 
     {
+        //Set the display to read '42'
         SetSegments(left,  0,1,1,0,0,1,1,0); //4
         SetSegments(right, 1,1,0,1,1,0,1,0); //2
     }