SEU_G10
/
rtos_3
rtos3
Fork of rtos_3 by
main.cpp@7:446175f23903, 2015-11-13 (annotated)
- Committer:
- xiscosc
- Date:
- Fri Nov 13 14:41:59 2015 +0000
- Revision:
- 7:446175f23903
- Parent:
- 3:c92e21f305d8
rtos3;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 1:491820ee784d | 1 | #include "mbed.h" |
emilmont | 1:491820ee784d | 2 | #include "rtos.h" |
emilmont | 1:491820ee784d | 3 | DigitalOut led1(LED1); |
emilmont | 1:491820ee784d | 4 | DigitalOut led2(LED2); |
xiscosc | 7:446175f23903 | 5 | double status; |
xiscosc | 7:446175f23903 | 6 | Timer t; |
xiscosc | 7:446175f23903 | 7 | bool b; |
xiscosc | 7:446175f23903 | 8 | |
xiscosc | 7:446175f23903 | 9 | void thread1(void const *args) { |
xiscosc | 7:446175f23903 | 10 | t.stop(); |
xiscosc | 7:446175f23903 | 11 | printf("The time taken was %d US_SECONDS (CON DIFERENTES PRIORIDADES) \r\n", t.read_us()); |
xiscosc | 7:446175f23903 | 12 | t.reset(); |
emilmont | 1:491820ee784d | 13 | while (true) { |
xiscosc | 7:446175f23903 | 14 | |
xiscosc | 7:446175f23903 | 15 | } |
emilmont | 1:491820ee784d | 16 | } |
xiscosc | 7:446175f23903 | 17 | int main() { |
xiscosc | 7:446175f23903 | 18 | led1 = false; |
xiscosc | 7:446175f23903 | 19 | led2 = false; |
xiscosc | 7:446175f23903 | 20 | b = true; |
xiscosc | 7:446175f23903 | 21 | Thread my_thread1(thread1, NULL, osPriorityLow); |
xiscosc | 7:446175f23903 | 22 | while (true) { |
xiscosc | 7:446175f23903 | 23 | t.start(); |
xiscosc | 7:446175f23903 | 24 | Thread::wait(300); |
xiscosc | 7:446175f23903 | 25 | } |
emilmont | 1:491820ee784d | 26 | } |