Xisco Sastre Cabot
/
rtos_2
rtos2
Fork of rtos_basic by
main.cpp@1:491820ee784d, 2012-07-12 (annotated)
- Committer:
- emilmont
- Date:
- Thu Jul 12 10:23:40 2012 +0000
- Revision:
- 1:491820ee784d
- Parent:
- 0:b7777a15fb91
- Child:
- 3:c92e21f305d8
First implementation of the rtos_basic test
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 | 1:491820ee784d | 7 | void led2_thread(void const *argument) { |
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 | } |