*****

Dependencies:   mbed

Committer:
knut_johan
Date:
Fri Oct 09 15:10:23 2015 +0000
Revision:
0:b34c8e79762b
l?reboka

Who changed what in which revision?

UserRevisionLine numberNew contents of line
knut_johan 0:b34c8e79762b 1 #include "mbed.h"
knut_johan 0:b34c8e79762b 2
knut_johan 0:b34c8e79762b 3 DigitalOut redled(PA_5);
knut_johan 0:b34c8e79762b 4 DigitalOut greenled(PA_6);
knut_johan 0:b34c8e79762b 5 DigitalIn switchinput(PB_7);
knut_johan 0:b34c8e79762b 6
knut_johan 0:b34c8e79762b 7 int main()
knut_johan 0:b34c8e79762b 8 { while(1) { // while loop
knut_johan 0:b34c8e79762b 9 if(switchinput==1) { // if loop
knut_johan 0:b34c8e79762b 10 redled=1;
knut_johan 0:b34c8e79762b 11 greenled=0;
knut_johan 0:b34c8e79762b 12 wait(0.5);
knut_johan 0:b34c8e79762b 13 redled=0;
knut_johan 0:b34c8e79762b 14 wait(0.5);
knut_johan 0:b34c8e79762b 15 } // end if loop
knut_johan 0:b34c8e79762b 16 else { // else loop
knut_johan 0:b34c8e79762b 17 greenled=1;
knut_johan 0:b34c8e79762b 18 redled=0;
knut_johan 0:b34c8e79762b 19 wait(0.5);
knut_johan 0:b34c8e79762b 20 greenled=0;
knut_johan 0:b34c8e79762b 21 wait(0.5);
knut_johan 0:b34c8e79762b 22 } // end else loop
knut_johan 0:b34c8e79762b 23 } // end while loop
knut_johan 0:b34c8e79762b 24 } // end main