Ray Liu
/
NuMaker-mbed-OS-Core-RTOS-Basic
Modify the file main.cpp for M487
Diff: main.cpp
- Revision:
- 0:0dfa64725959
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 29 05:44:18 2017 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "rtos.h" +#if defined(TARGET_NUMAKER_PFM_NUC472) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#elif defined(TARGET_NUMAKER_PFM_M453) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#elif defined(TARGET_NUMAKER_PFM_M487) +DigitalOut led1(LED1); +DigitalOut led2(LED2); +#endif + +void led2_thread(void const *args) { + while (true) { + led2 = !led2; + Thread::wait(1000); + } +} + +int main() { + Thread thread(led2_thread); + + while (true) { + led1 = !led1; + Thread::wait(500); + } +}