takashi kadono
/
mbed-os-example-blinky
Fork of https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-blinky/
Revision 45:f730263c5ce1, committed 2017-12-04
- Comitter:
- kadonotakashi
- Date:
- Mon Dec 04 06:24:51 2017 +0000
- Parent:
- 44:4ebd764e1db9
- Commit message:
- use OS
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 04 03:11:05 2017 +0000 +++ b/main.cpp Mon Dec 04 06:24:51 2017 +0000 @@ -2,11 +2,27 @@ DigitalOut led1(LED1); -// main() runs in its own thread in the OS -int main() { - while (true) { - led1 = !led1; - wait(2.5); + +void led1_thread(void const *argument) +{ + while(true){ + led1=!led1; + Thread::wait(1000); } } + +//Serial pc(USBTX, USBRX); // tx, rx + +// main() runs in its own thread in the OS +int main() +{ + Thread thread(led1_thread); + + while (true) { +// pc.printf("main thread \r\n"); + printf("main thread \r\n"); + Thread::wait(3000); + } +} +