diff --git a/main.cpp b/main.cpp index fb0734f..ff671ad 100644 --- a/main.cpp +++ b/main.cpp @@ -9,20 +9,27 @@ static DigitalOut led2(LED2); static DigitalOut led3(LED6); static DigitalOut led4(LED5); -int main() -{ - s_leds.push_back(led1); - s_leds.push_back(led2); - s_leds.push_back(led3); - s_leds.push_back(led4); +static Thread s_thread_blink; +void thread_proc_blink(std::vector *pleds) +{ while (true) { - for (std::vector::iterator it=s_leds.begin();it!=s_leds.end();it++) + for (std::vector::iterator it = pleds->begin(); it != pleds->end(); it++) { it->write(!it->read()); wait_ms(125); } } +} + +int main() +{ + s_leds.push_back(led1); + s_leds.push_back(led2); + s_leds.push_back(led3); + s_leds.push_back(led4); + + s_thread_blink.start(callback(thread_proc_blink, &s_leds)); } \ No newline at end of file