blink a led

Dependencies:   mbed

Committer:
Maggie17
Date:
Sat May 28 04:11:22 2016 +0000
Revision:
12:8dab8b91a92c
Parent:
4:81cea7a352b0
Child:
13:769319201354
add the comments

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 12:8dab8b91a92c 10 // turn on 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 12:8dab8b91a92c 16 // YOUR CODE HERE : turn off the LED
Maggie17 12:8dab8b91a92c 17
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 }