Tobore Denedo
/
Polling-step2
Polling-step2
Fork of ToboreDenedo by
Revision 3:47c4fb4a9216, committed 2018-01-29
- Comitter:
- Tobden
- Date:
- Mon Jan 29 16:45:07 2018 +0000
- Parent:
- 2:cd1fe8c29793
- Commit message:
- Polling Program for blinking light;
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 Mon Jan 29 16:45:07 2018 +0000 @@ -13,6 +13,7 @@ Thread pollT ; // thread to poll volatile int pressEvent = 0 ; // Variabe set by the polling thread +volatile int counter = 2; enum buttonPos { up, down, bounce }; // Button positions void polling() { @@ -53,11 +54,15 @@ led = 1 ; // Initially off pollT.start(callback(polling)); - while(true) { + while(true) + { led=!led; if (pressEvent) { pressEvent = 0 ; // clear the event variable - led = !led ; - } - Thread::wait(100) ; + if (counter<10) + counter+=2; + else + counter = 2; + } + Thread::wait(100*counter) ; } } \ No newline at end of file