2016/2/29 LED Yu-Hsuan edited

Dependencies:   mbed

Revision:
3:b81cc31bfcba
Parent:
2:9e5b526db3aa
diff -r 9e5b526db3aa -r b81cc31bfcba main.cpp
--- a/main.cpp	Thu Mar 03 05:09:48 2016 +0000
+++ b/main.cpp	Thu Mar 03 05:35:47 2016 +0000
@@ -7,7 +7,6 @@
 DigitalOut led_1(LED_1);
 DigitalOut led_2(LED_2);
 Ticker timer_1;
-bool light;
 
 int timer_1_counter;
 
@@ -17,7 +16,6 @@
     led_2 = 0;
     
     timer_1_counter = 0;
-    light = false;
 }
 
 void timer_1_interrupt()
@@ -40,16 +38,10 @@
         if(timer_1_counter == 1000)
         {
             // led_1 flashes
-            if(light == false)
-            {
+            if(led_1 == 0)
                 led_1 = 1;
-                light = true;
-            }
             else
-            {  
                 led_1 = 0;
-                light = false;
-            }
             
             // reset timer_1_counter to zero
             timer_1_counter = 0;