Skip to content
Permalink
9fed8157b1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
27 lines (22 sloc) 458 Bytes
#include <mbed.h>
DigitalOut led1(LED1);
DigitalOut led2(LED2);
//Create an empty thread object ready to attach a function
Thread thread;
//Function to deal with blinking the second LED
void led2_thread() {
//Loop forever
while (true) {
led2 = !led2;
thread_sleep_for(1000);
}
}
//Main Program
int main() {
//Attach the function to the Thread then Start it
thread.start(led2_thread);
while (true) {
led1 = !led1;
thread_sleep_for(500);
}
}