
Sample program for lab 5
Revision 6:71ef35e456ab, committed 2020-02-20
- Comitter:
- WilliamMarshQMUL
- Date:
- Thu Feb 20 11:28:36 2020 +0000
- Parent:
- 5:2a9a3d74a1d8
- Commit message:
- Update RTOS and use sleep_for
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2a9a3d74a1d8 -r 71ef35e456ab main.cpp --- a/main.cpp Tue Feb 19 09:38:31 2019 +0000 +++ b/main.cpp Thu Feb 20 11:28:36 2020 +0000 @@ -23,7 +23,7 @@ while (true) { signals.wait_any(REDFLAG); redLED = false ; // turn on - wait(5.0); + ThisThread::sleep_for(5000) ; // wait(5.0); redLED = true ; // turn off signals.clear(REDFLAG) ; // Signal are automatically cleared by wait_any but @@ -35,7 +35,7 @@ while (true) { signals.wait_any(GREENFLAG); greenLED = false ; // turn on - wait(5.0); + ThisThread::sleep_for(5000) ; // wait(5.0); greenLED = true ; // turn off signals.clear(GREENFLAG) ; // Signal are automatically cleared by wait_any but @@ -57,7 +57,7 @@ pc.putc(' ') ; if (d == 10) signals.set(REDFLAG) ; if (d == 20) signals.set(GREENFLAG) ; - wait(0.5); // This polling rate is too slow - increase it + ThisThread::sleep_for(500) ; // This polling rate is too slow - increase it // The slower rate maks it easier to output on the terminal } } \ No newline at end of file
diff -r 2a9a3d74a1d8 -r 71ef35e456ab mbed-os.lib --- a/mbed-os.lib Tue Feb 19 09:38:31 2019 +0000 +++ b/mbed-os.lib Thu Feb 20 11:28:36 2020 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#bc132a6066cafdb9e4028251b5aff7cfcbcaa444 +https://github.com/ARMmbed/mbed-os/#c12b433026beae5b3b769c27941bc6d7fe5d4b27