Osama Sattar / Mbed 2 deprecated ME21001_Lab02_exercise_02

Dependencies:   mbed

main.cpp

Committer:
oosattar
Date:
2016-09-21
Revision:
0:a5aeb2522cca

File content as of revision 0:a5aeb2522cca:

/****************************************************************
/ simple program to show basic program structure 
/
/ the program flashes onboard LED #1 on/off and a rate of 1Hz 
/
*****************************************************************/




#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {                    //repeat indefinitly 
       uint8_t x = 0;             //set start interger value as 0
           while(x < 5)  {        //while "x" interger value is less than 5 run rest of program
            myled = 1;            //turn on LED 1
            wait(1.0);            //wait 1s
            myled = 0;            //turn LED 1 off
            wait(1.0);            //wait 1s
            x= x + 1;             //add 1 to "x" integer value
        }
        wait(5.0);                //wait 5s
    }
}