William Marsh
/
thread-example2
Thread example using mbed 5.7
Diff: main.cpp
- Revision:
- 2:b13b343de0f5
- Parent:
- 1:bbbe0fae16f3
diff -r bbbe0fae16f3 -r b13b343de0f5 main.cpp --- a/main.cpp Wed Jan 09 22:58:08 2019 +0000 +++ b/main.cpp Thu Jan 23 13:05:26 2020 +0000 @@ -1,5 +1,5 @@ -// Simple Example fo use of Threads on mbed OS 5 -// Only need to include mbed.h +// Simple Example of use of Threads on mbed OS 5 +// Depreciated use of wait replaced by 'sleep_for' #include "mbed.h" @@ -12,7 +12,8 @@ // This method is run in the second thread void ledB_thread() { while (true) { - wait(0.25); + //wait(0.25); -- depreciated call + ThisThread::sleep_for(250) ; ledB = !ledB; } } @@ -26,7 +27,8 @@ thread.start(callback(ledB_thread)); while (true) { - wait(0.4); + // wait(0.4); - depreciated call + ThisThread::sleep_for(400) ; ledA = !ledA; } }