blink a led

Dependencies:   mbed

Committer:
Maggie17
Date:
Sat May 28 06:32:09 2016 +0000
Revision:
13:769319201354
Parent:
12:8dab8b91a92c
Child:
14:a937e53670d2
modify

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Maggie17 12:8dab8b91a92c 1 #include "mbed.h" // this tells us to load mbed related functions
dan 0:7dec7e9ac085 2
Maggie17 12:8dab8b91a92c 3 DigitalOut myled(LED1); // we create a variable 'red', use it as an out port
Maggie17 12:8dab8b91a92c 4
Maggie17 12:8dab8b91a92c 5 // this code runs when the microcontroller starts up
dan 0:7dec7e9ac085 6 int main() {
Maggie17 12:8dab8b91a92c 7
Maggie17 12:8dab8b91a92c 8 // spin in a main loop all the time
dan 0:7dec7e9ac085 9 while(1) {
Maggie17 13:769319201354 10 // turn off LED
dan 0:7dec7e9ac085 11 myled = 1;
Maggie17 12:8dab8b91a92c 12
Maggie17 12:8dab8b91a92c 13 // wait
dan 0:7dec7e9ac085 14 wait(0.2);
Maggie17 12:8dab8b91a92c 15
Maggie17 13:769319201354 16 // YOUR CODE HERE : turn on the LED
Maggie17 13:769319201354 17 myled = 0;
Maggie17 12:8dab8b91a92c 18
Maggie17 12:8dab8b91a92c 19 // wait again
stevep 4:81cea7a352b0 20 wait(0.2);
stevep 4:81cea7a352b0 21 }
dan 0:7dec7e9ac085 22 }