ARM Shanghai IoT Team (Internal)
/
threadbaseapp_JacobShi
use the thread the control 3 leds
Fork of rtos_basic by
main.cpp
- Committer:
- shiyilei
- Date:
- 2014-10-27
- Revision:
- 7:c3d06470b694
- Parent:
- 3:c92e21f305d8
File content as of revision 7:c3d06470b694:
/********************************************* *file name : the first thread app *Creator :JacobShi *Time:2014/10/27 * Description :use the thread the control 3 leds ******************************************/ #include "mbed.h" #include "rtos.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); void led1_task(void const* args) { while(1) { led1=!led1; Thread::wait(500); } } void led2_task(void const* args) { while(1) { led2=!led2; Thread::wait(1000); } } void led3_task(void const*args) { while(1) { led3=!led3; Thread::wait(250); } } int main(void) { Thread led1_thread1(led1_task); Thread led2_thread2(led2_task); Thread led3_thread3(led3_task); while(1) { } }