Say Pulung
/
TestThreadRTOS
RTOS Example
main.cpp
- Committer:
- saypulung
- Date:
- 2015-03-30
- Revision:
- 0:837f2afb6c50
File content as of revision 0:837f2afb6c50:
#include "mbed.h" #include "rtos.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); void pLED1(void const *args){ while(1) { led1 = 1; Thread::wait(100); led1 = 0; Thread::wait(100); } } void pLED2(void const *args){ while(1) { led2 = 1; Thread::wait(50); led2 = 0; Thread::wait(50); } } void pLED3(void const *args){ while(1) { led3 = 1; Thread::wait(300); led3 = 0; Thread::wait(300); } } int main(){ Thread thread1(pLED1); Thread thread2(pLED2); Thread thread3(pLED3); while(1){ led4 = 1; Thread::wait(200); led4 = 0; Thread::wait(200); } }