Lab3

Dependencies:   mbed-rtos mbed

Fork of ESE519_Lab3_v2 by ese519

Revision:
3:2f8e2399dfe8
Parent:
2:d7103c7e0671
--- a/main.cpp	Fri Oct 16 16:54:34 2015 +0000
+++ b/main.cpp	Fri Oct 16 17:01:02 2015 +0000
@@ -56,9 +56,6 @@
 
 int main() {
    
-    // start button checker thread
-    bpc_thread = new Thread(bpc_func);
-   
     // init interrupt handler
     IRSensor.fall(&get_period);
    
@@ -80,7 +77,10 @@
         while (!cur_floor) { // wait for a floor to be detected
             wait(0.25);
         }
-        if (!desired_floor) desired_floor = cur_floor;
+        if (!desired_floor) { 
+            desired_floor = cur_floor;
+            bpc_thread = new Thread(bpc_func); // start button checker thread
+        }
         led_update();
        
         // check for key press