Demo Team / Mbed 2 deprecated Drone_Timer

Dependencies:   Display mbed

Fork of Timer by DRONE COURSE

Files at this revision

API Documentation at this revision

Comitter:
Jamestom999
Date:
Thu Jul 30 16:18:40 2015 +0000
Parent:
1:f5ee66d417f8
Commit message:
.;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jul 30 08:03:01 2015 +0000
+++ b/main.cpp	Thu Jul 30 16:18:40 2015 +0000
@@ -25,6 +25,8 @@
 {   
     int count=0;
     
+    LED_Launch=1;
+    
     wait(0.5);                //Allow other IC's to power up
     DisplayInit();
     
@@ -43,34 +45,14 @@
     //DisplayScroll("dont crash   get a badge");
     //timer=Reset;
     
-    while(true){
-        count++;
-        if(count>150000){
-            count=0;
-            if(timer==Reset){
-                LED_Launch=!LED_Launch;
-            }else{
-                LED_Launch=0;
-            }
-        }
-        
-        if(timer==Start){
-            LED_Timer=1;
-        }else{
-            LED_Timer=0;
-        }
-        
-        if(timer==Pause){
-            LED_Finish=1;
-        }else{
-            LED_Finish=0;
-        }
+    
+    while(true){ 
         
         if(!Button_Launch && timer==Start){
             Time+=1000;
-            wait(0.1f);
+            wait(0.2f);
             while(!Button_Launch){}
-            wait(0.1f);
+            wait(0.2f);
         }
         
         if(!Button_Launch && timer==Reset){
@@ -103,9 +85,10 @@
             LED_Timer=1;
             wait(2);
             LED_Launch=0;               //Turn off the light
+            wait(0.2f);
         }
         
-        if(Button_Reset&&(timer==Start)){
+        if(Button_Reset && (timer==Start)){
             char n='F';
             timer=Pause;
             if(!Button_Sel1){
@@ -113,11 +96,15 @@
             }
             wait(0.1f);
             while(Button_Reset){}
-            wait(0.1f);
+            LED_Timer=0;
+            LED_Finish=1;
+            wait(0.2);
         }
         
-        if(Button_Reset&&(timer==Pause)){
+        if(Button_Reset && (timer==Pause)){
             timer=Reset;
+            LED_Finish=0;
+            wait(0.2);
         }
         
         if(Camera && (timer==Start)){
@@ -126,6 +113,9 @@
             if(!Button_Sel1){
                 i2c.write(Sound, &n, 1);    //End sound
             }
+            LED_Timer=0;
+            LED_Finish=1;
+            wait(0.2);
         }
         
     }