Xisco Sastre Cabot
/
rtos_3
rtos3
Fork of rtos_basic by
Diff: main.cpp
- Revision:
- 7:446175f23903
- Parent:
- 3:c92e21f305d8
diff -r 209f4db62daf -r 446175f23903 main.cpp --- a/main.cpp Tue Jun 04 16:01:32 2013 +0100 +++ b/main.cpp Fri Nov 13 14:41:59 2015 +0000 @@ -1,21 +1,26 @@ #include "mbed.h" #include "rtos.h" - DigitalOut led1(LED1); DigitalOut led2(LED2); - -void led2_thread(void const *args) { +double status; +Timer t; +bool b; + +void thread1(void const *args) { + t.stop(); + printf("The time taken was %d US_SECONDS (CON DIFERENTES PRIORIDADES) \r\n", t.read_us()); + t.reset(); while (true) { - led2 = !led2; - Thread::wait(1000); + + } } +int main() { + led1 = false; + led2 = false; + b = true; + Thread my_thread1(thread1, NULL, osPriorityLow); + while (true) { + t.start(); + Thread::wait(300); + } } - -int main() { - Thread thread(led2_thread); - - while (true) { - led1 = !led1; - Thread::wait(500); - } -}