blink a led

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"         // this tells us to load mbed related functions
00002 
00003 DigitalOut myled(LED1);   // we create a variable 'myled', use it as an out port
00004  
00005 // this code runs when the microcontroller starts up
00006 int main() {
00007     
00008     // spin in a main loop all the time
00009     while(1) {
00010         // turn on LED
00011         myled = 1;
00012         
00013         // wait
00014         wait(0.2);
00015         
00016         // YOUR CODE HERE : turn off the LED
00017         
00018         
00019         // wait again
00020         wait(0.2);
00021     }
00022 }