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.
Dependencies: mbed X_NUCLEO_IHM03A1_for
Diff: main.cpp
- Revision:
- 2:35f13b7f3659
- Parent:
- 0:5701b41769fd
- Child:
- 3:a469bbd294b5
--- a/main.cpp Wed Jun 07 13:55:59 2017 +0000 +++ b/main.cpp Thu Nov 23 13:09:25 2017 +0000 @@ -1,5 +1,4 @@ #include "mbed.h" -#include "rtos.h" void print_char(char c = '*') { @@ -7,12 +6,14 @@ fflush(stdout); } +Thread thread; + DigitalOut led1(LED1); -void print_thread(void const *argument) +void print_thread() { while (true) { - Thread::wait(1000); + wait(1); print_char(); } } @@ -20,9 +21,11 @@ int main() { printf("\n\n*** RTOS basic example ***\n"); - Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + + thread.start(print_thread); + while (true) { led1 = !led1; - Thread::wait(500); + wait(0.5); } }