Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of digitalInPolling_sample by
Revision 3:914be74674bb, committed 2018-02-01
- Comitter:
- Sarang
- Date:
- Thu Feb 01 17:19:35 2018 +0000
- Parent:
- 2:cd1fe8c29793
- Commit message:
- Final;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file | 
--- a/main.cpp	Tue Jan 16 18:02:44 2018 +0000
+++ b/main.cpp	Thu Feb 01 17:19:35 2018 +0000
@@ -14,6 +14,8 @@
 Thread pollT ; // thread to poll
 volatile int pressEvent = 0 ;  // Variabe set by the polling thread
 
+volatile int timez = 200 ;
+
 enum buttonPos { up, down, bounce }; // Button positions
 void polling() {
     buttonPos pos = up ;
@@ -54,10 +56,23 @@
     pollT.start(callback(polling));
 
     while(true) {
+        led = !led ;
         if (pressEvent) {
             pressEvent = 0 ; // clear the event variable
-            led = !led ;
+            
+            if (timez<1000)
+            {
+                timez+=200;     
+            }           
+            
+            else 
+            {
+                timez=200;
+            }    
         }
-        Thread::wait(100) ;
+        
+        Thread::wait(timez);
+                    
     }
-}
\ No newline at end of file
+}
+
    