Joystick

Dependencies:   mbed

Fork of app-board-Joystick by Chris Styles

Revision:
1:6d189395a003
Parent:
0:0e4db18afd77
--- /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);
+    }
+}