Program

Dependencies:   mbed

main.cpp

Committer:
VigneshRSR
Date:
2015-04-26
Revision:
0:7a58f4179dc2

File content as of revision 0:7a58f4179dc2:

#include "mbed.h"

DigitalIn mybutton(USER_BUTTON);
DigitalOut myled(LED1);

float i = 1.0;

int main()
{
    while(1) {
        if (mybutton == 0) { //Read the button press
            if (i == 1.0)
                i = 0.5;
        }
        if (mybutton == 0) { //Read the button press
            if (i == 0.5)
                i = 0.25;
        }
        if (mybutton == 0) { //Read the button press
            if (i == 0.25)
                i = 0.125;
        }
        if (mybutton == 0) { //Read the button press
            if (i == 0.125)
                i = 0.0625;
        }
        myled = 1;
        wait(i);
        myled = 0;
        wait(i);
    }
}