Yoji KURODA
/
Mechatro_ThreadTest
Sample code for Mechatronics class
main.cpp
- Committer:
- Bartek Szatkowski
- Date:
- 2017-01-11
- Revision:
- 4:fc60c5b6c104
- Parent:
- 1:6a8fcc666593
- Child:
- 5:476186ff82cf
File content as of revision 4:fc60c5b6c104:
#include "mbed.h" #include "rtos.h" DigitalOut led(LED1); void led_thread() { while (true) { // Signal flags that are reported as event are automatically cleared. Thread::signal_wait(0x1); led = !led; } } int main (void) { Thread thread; thread.start(callback(led_thread)); while (true) { Thread::wait(1000); thread.signal_set(0x1); } }