Basic timer on mBed 1768

Dependencies:   TextLCD mbed

Fork of HelloWorld by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
jatinsha
Date:
Sun Sep 28 03:53:02 2014 +0000
Parent:
2:253054128736
Commit message:
unpause mapped to start

Changed in this revision

keypad.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/keypad.lib	Sun Sep 28 03:02:57 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/DimiterK/code/keypad/#1fa357ea3fcc
--- a/main.cpp	Sun Sep 28 03:02:57 2014 +0000
+++ b/main.cpp	Sun Sep 28 03:53:02 2014 +0000
@@ -11,7 +11,6 @@
 3. Keyboard Input           : http://mbed.org/handbook/SerialPC
 4. Interrupt attach         : http://mbed.org/handbook/Serial
 5. Enum tutorial            : http://stackoverflow.com/questions/1102542/how-to-define-an-enumerated-type-enum-in-c
-6. 
 
 */
 
@@ -53,6 +52,12 @@
                 timerDisplay.start();
                 timerState = Running;
             }
+            else if(timerState == Paused)
+            {
+                timerReference.start();
+                timerDisplay.start();
+                timerState = Running;
+            }
         }
         if((keyboardInput == 'p' || keyboardInput == 'P')) 
         {
@@ -62,12 +67,7 @@
                 timerDisplay.stop();
                 timerState = Paused;
             }
-            else if(timerState == Paused)
-            {
-                timerReference.start();
-                timerDisplay.start();
-                timerState = Running;
-            }
+            
         } 
         if((keyboardInput == 'r' || keyboardInput == 'R')) 
         {  
@@ -84,8 +84,8 @@
                 calculatedTimeInterval = referenceTimeInterval = runningError = 0;
                 lcd.locate(0,0);
                 lcd.printf("00:00:00");
-                lcd.locate(0,1);
-                lcd.printf("000000");
+                //lcd.locate(0,1);
+                //lcd.printf("000000");
             }
         } 
     }
@@ -138,8 +138,8 @@
             lcd.locate(0,0);
             lcd.printf("%02d:%02d:%02d",minutes, seconds, centiSeconds);
             
-            lcd.locate(0,1);
-            lcd.printf("%06d", runningError);
+            //lcd.locate(0,1);
+            //lcd.printf("%06d", runningError);
             }