mbed_example / Mbed OS rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 DigitalOut led1(LED1);
00004 DigitalOut led2(LED2);
00005 Thread thread;
00006  
00007 void led2_thread() {
00008     while (true) {
00009         led2 = !led2;
00010         wait(1);
00011     }
00012 }
00013  
00014 int main() {
00015     thread.start(led2_thread);
00016     
00017     while (true) {
00018         led1 = !led1;
00019         wait(0.5);
00020     }
00021 }