Joystick2
Dependencies: mbed
Fork of FTKL_board-Joystick2 by
Diff: FTKL_board-Joystick2.cpp
- Revision:
- 0:1ee1d2b34ead
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FTKL_board-Joystick2.cpp Wed Apr 29 15:53:32 2015 +0000 @@ -0,0 +1,64 @@ +#include "mbed.h" + +BusIn biJoy(p15,p12,p13,p16); +DigitalIn diFire(p14); + +BusOut doLeds(LED1,LED2,LED3,LED4); + +int main() +{ + doLeds=0; + + while(1) + { + if (diFire) + { + doLeds=0; + } + + if (biJoy==1) + { + while (1) + { + + doLeds=doLeds<<1; + + if (doLeds==16 ||doLeds== 0) + { + doLeds=1; + } + + if (diFire) + { + doLeds=0; + break; + } + + wait(0.5); + } + } + + if (biJoy==2) + { + while(1) + + { + doLeds=doLeds>>1; + + + if (doLeds==16||doLeds==0) + { + doLeds=8; + } + + if (diFire) + { + doLeds=0; + break; + } + + wait(0.5); + } + } + } //while 1 +} //main