Lab3

Dependencies:   mbed-rtos mbed

Fork of ESE519_Lab3_EC_v3 by ese519

Files at this revision

API Documentation at this revision

Comitter:
jfields
Date:
Fri Oct 16 20:13:24 2015 +0000
Parent:
8:4b0f6f68db12
Commit message:
a

Changed in this revision

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