Program

Dependencies:   mbed

Committer:
VigneshRSR
Date:
Sun Apr 26 16:46:58 2015 +0000
Revision:
0:7a58f4179dc2
Test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
VigneshRSR 0:7a58f4179dc2 1 #include "mbed.h"
VigneshRSR 0:7a58f4179dc2 2
VigneshRSR 0:7a58f4179dc2 3 DigitalIn mybutton(USER_BUTTON);
VigneshRSR 0:7a58f4179dc2 4 DigitalOut myled(LED1);
VigneshRSR 0:7a58f4179dc2 5
VigneshRSR 0:7a58f4179dc2 6 float i = 1.0;
VigneshRSR 0:7a58f4179dc2 7
VigneshRSR 0:7a58f4179dc2 8 int main()
VigneshRSR 0:7a58f4179dc2 9 {
VigneshRSR 0:7a58f4179dc2 10 while(1) {
VigneshRSR 0:7a58f4179dc2 11 if (mybutton == 0) { //Read the button press
VigneshRSR 0:7a58f4179dc2 12 if (i == 1.0)
VigneshRSR 0:7a58f4179dc2 13 i = 0.5;
VigneshRSR 0:7a58f4179dc2 14 }
VigneshRSR 0:7a58f4179dc2 15 if (mybutton == 0) { //Read the button press
VigneshRSR 0:7a58f4179dc2 16 if (i == 0.5)
VigneshRSR 0:7a58f4179dc2 17 i = 0.25;
VigneshRSR 0:7a58f4179dc2 18 }
VigneshRSR 0:7a58f4179dc2 19 if (mybutton == 0) { //Read the button press
VigneshRSR 0:7a58f4179dc2 20 if (i == 0.25)
VigneshRSR 0:7a58f4179dc2 21 i = 0.125;
VigneshRSR 0:7a58f4179dc2 22 }
VigneshRSR 0:7a58f4179dc2 23 if (mybutton == 0) { //Read the button press
VigneshRSR 0:7a58f4179dc2 24 if (i == 0.125)
VigneshRSR 0:7a58f4179dc2 25 i = 0.0625;
VigneshRSR 0:7a58f4179dc2 26 }
VigneshRSR 0:7a58f4179dc2 27 myled = 1;
VigneshRSR 0:7a58f4179dc2 28 wait(i);
VigneshRSR 0:7a58f4179dc2 29 myled = 0;
VigneshRSR 0:7a58f4179dc2 30 wait(i);
VigneshRSR 0:7a58f4179dc2 31 }
VigneshRSR 0:7a58f4179dc2 32 }