Lab3

Dependencies:   mbed-rtos mbed

Fork of ESE519_Lab3_EC_v3 by ese519

Revision:
9:d7a9c2345e9e
Parent:
8:4b0f6f68db12
--- a/main.cpp	Fri Oct 16 19:39:37 2015 +0000
+++ b/main.cpp	Fri Oct 16 20:13:24 2015 +0000
@@ -13,6 +13,7 @@
 void update_q();
 void el_alg();  // need sorted list
 void bubble_sort();
+void led_q();
 
 // Threads
 void bpc_func(void const *args);
@@ -81,9 +82,9 @@
         }
         if (!desired_floor) { 
             desired_floor = cur_floor;
+            led_update();
             bpc_thread = new Thread(bpc_func); // start button checker thread
         }
-        led_update();
        
         // check for key press
         //find_keys();
@@ -299,6 +300,7 @@
         }
     }
     desired_floor = el_q[0];
+    led_q();
 }
 
 
@@ -321,5 +323,14 @@
     el_alg();
 }
 
+void led_q() {
+    led1 = 0;
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
+    if (el_q_size >= 1) led1 = 1;
+    if (el_q_size >= 2) led2 = 1;
+    if (el_q_size >= 3) led3 = 1;
+    if (el_q_size >= 4) led4 = 1;
+}
 
-