3

Dependencies:   mbed

Committer:
davey
Date:
Sat Sep 23 17:50:39 2017 +0000
Revision:
0:69d25838a298
ex3;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davey 0:69d25838a298 1 #include "mbed.h"
davey 0:69d25838a298 2
davey 0:69d25838a298 3 DigitalOut myled(LED1); // use onboard LED #1
davey 0:69d25838a298 4
davey 0:69d25838a298 5 int main() {
davey 0:69d25838a298 6
davey 0:69d25838a298 7
davey 0:69d25838a298 8 while (1) { // repeat indefinitely
davey 0:69d25838a298 9 int x = 0; // declares 'x' integer
davey 0:69d25838a298 10 while (x < 25) { //Starts loop to go 25 times
davey 0:69d25838a298 11 myled = 1; // turn on LED #1
davey 0:69d25838a298 12 wait(0.5); // wait 0.5s
davey 0:69d25838a298 13 myled = 0; // turn off LED #1
davey 0:69d25838a298 14 wait(0.5); // wait 0.5s
davey 0:69d25838a298 15 x = x + 1; //adds 1 increment to x each time round the loop
davey 0:69d25838a298 16 }
davey 0:69d25838a298 17 wait(5); //waits 5 seconds before repeating
davey 0:69d25838a298 18 }
davey 0:69d25838a298 19 }