Joystick2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Planinsec
Date:
Wed Apr 29 15:53:32 2015 +0000
Commit message:
FTKL

Changed in this revision

FTKL_board-Joystick2.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 1ee1d2b34ead FTKL_board-Joystick2.cpp
--- /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
diff -r 000000000000 -r 1ee1d2b34ead mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Apr 29 15:53:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file