3

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut myled(LED1); // use onboard LED #1
00004 
00005 int main() {
00006 
00007  
00008  while (1) {        // repeat indefinitely
00009      int x = 0;     // declares 'x' integer
00010         while (x < 25) {     //Starts loop to go 25 times
00011             myled = 1;     // turn on LED #1
00012             wait(0.5);   // wait 0.5s
00013             myled = 0;     // turn off LED #1
00014             wait(0.5);   // wait 0.5s 
00015             x = x + 1; //adds 1 increment to x each time round the loop
00016        }
00017        wait(5);     //waits 5 seconds before repeating
00018     }
00019 }