Jiajun Zhang
/
digitalInPolling_sample
LAB 2 answer to polling
Fork of digitalInPolling_sample by
Revision 3:2a7570e265fd, committed 2018-02-02
- Comitter:
- Bossman
- Date:
- Fri Feb 02 11:37:18 2018 +0000
- Parent:
- 2:cd1fe8c29793
- Commit message:
- Version 1
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 Fri Feb 02 11:37:18 2018 +0000 @@ -49,15 +49,31 @@ /* ---- Main function (default thread) ---- Note that if this thread completes, nothing else works */ -int main() { +int main() +{ led = 1 ; // Initially off pollT.start(callback(polling)); - - while(true) { + int i=1; + while(true) + { if (pressEvent) { pressEvent = 0 ; // clear the event variable + if (i==6){ + i=1; + } + while(1){ + led = !led ; - } + Thread::wait(i*200); + if (pressEvent){ + i++; + break; + } + + + } +} + Thread::wait(100) ; } } \ No newline at end of file