Joystick
Dependencies: mbed
Fork of app-board-Joystick by
Revision 1:6d189395a003, committed 2015-04-29
- Comitter:
- Planinsec
- Date:
- Wed Apr 29 15:31:31 2015 +0000
- Parent:
- 0:0e4db18afd77
- Commit message:
- FTKL
Changed in this revision
FTKL_board-Joystick.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show diff for this revision Revisions of this file |
diff -r 0e4db18afd77 -r 6d189395a003 FTKL_board-Joystick.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FTKL_board-Joystick.cpp Wed Apr 29 15:31:31 2015 +0000 @@ -0,0 +1,41 @@ +#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) + { + doLeds=doLeds<<1; + + if (doLeds==16 ||doLeds== 0) + { + doLeds=1; + } + } + + if (biJoy==2) + { + doLeds=doLeds>>1; + + + if (doLeds==16||doLeds==0) + { + doLeds=8; + } + } + + wait(0.5); + } +}
diff -r 0e4db18afd77 -r 6d189395a003 main.cpp --- a/main.cpp Mon Oct 15 13:37:36 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "mbed.h" - -BusIn joy(p15,p12,p13,p16); -DigitalIn fire(p14); - -BusOut leds(LED1,LED2,LED3,LED4); - -int main() -{ - while(1) { - if (fire) { - leds=0xf; - } else { - leds=joy; - } - wait(0.1); - } -}