Xisco Sastre Cabot
/
rtos_3
rtos3
Fork of rtos_basic by
main.cpp@3:c92e21f305d8, 2012-11-23 (annotated)
- Committer:
- emilmont
- Date:
- Fri Nov 23 09:58:48 2012 +0000
- Revision:
- 3:c92e21f305d8
- Parent:
- 1:491820ee784d
- Child:
- 7:446175f23903
Update to latest mbed and rtos libraries
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 | |
emilmont | 1:491820ee784d | 4 | DigitalOut led1(LED1); |
emilmont | 1:491820ee784d | 5 | DigitalOut led2(LED2); |
emilmont | 1:491820ee784d | 6 | |
emilmont | 3:c92e21f305d8 | 7 | void led2_thread(void const *args) { |
emilmont | 1:491820ee784d | 8 | while (true) { |
emilmont | 1:491820ee784d | 9 | led2 = !led2; |
emilmont | 1:491820ee784d | 10 | Thread::wait(1000); |
emilmont | 1:491820ee784d | 11 | } |
emilmont | 1:491820ee784d | 12 | } |
emilmont | 1:491820ee784d | 13 | |
emilmont | 1:491820ee784d | 14 | int main() { |
emilmont | 1:491820ee784d | 15 | Thread thread(led2_thread); |
emilmont | 1:491820ee784d | 16 | |
emilmont | 1:491820ee784d | 17 | while (true) { |
emilmont | 1:491820ee784d | 18 | led1 = !led1; |
emilmont | 1:491820ee784d | 19 | Thread::wait(500); |
emilmont | 1:491820ee784d | 20 | } |
emilmont | 1:491820ee784d | 21 | } |