RoboCup Base Station

Dependencies:   mbed mbed-rtos Wireless Drivers

Revision:
3:c3114df544e8
Parent:
2:7fd95eae5731
Child:
4:ec95917c3211
diff -r 7fd95eae5731 -r c3114df544e8 main.cpp
--- a/main.cpp	Wed Dec 31 09:17:06 2014 +0000
+++ b/main.cpp	Wed Dec 31 09:32:08 2014 +0000
@@ -21,7 +21,7 @@
 {
     // latch pin for 7-seg
     DigitalOut latch( RJ_7_SEG_LATCH_PIN, 0 );
-    
+
     // Decimal point initialized to OFF
     DigitalOut decimal( RJ_7_SEG_DOT_PIN, 1 );
 
@@ -31,10 +31,10 @@
 
     // wait to be signaled before beginning
     osSignalWait(0x01, osWaitForever);
-    
+
     // give a small delay to ensure the startup value stays lit for some time
     Thread::wait(500);
-    
+
     // turn the decimal point off
     decimal = 0;
 
@@ -73,20 +73,39 @@
     // =========== Cyle primary & secondary radio status LEDs ===========
     // turn on all radio status LEDs
     for (int i=0; i<3; i++) {
-        r1_led[i] = 0;
-        r2_led[i] = 0;
-        Thread::wait(50);
+
+        // initialze off at the start of every iteration
+        for(int j=0; j<3; j++) {
+            r1_led[j] = 1;
+            r2_led[j] = 1;
+        }
+
+        if (i != 2) {
+            // cycle 2 LEDs
+            for (int j=i; j<2; j++) {
+                r1_led[j] = 0;
+                r2_led[j] = 0;
+                Thread::wait(50);
+            }
+        } else {
+            r1_led[i] = 0;
+            r2_led[i] = 0;
+            Thread::wait(50);
+            r1_led[i] = 1;
+            r2_led[i] = 1;
+        }
     }
+/*    
     // turn off all radio status LEDs
     for (int i=0; i<3; i++) {
         r1_led[i] = 1;
         r2_led[i] = 1;
         Thread::wait(50);
     }
-
+*/
     // give power to all colors of the RGB LED and turn off decimal point
     rgb_pwr = 1;
-    
+
     // tell the segment thread to begin its task
     thread_seg_task.signal_set(0x01);