Joystick

Dependencies:   mbed

Fork of app-board-Joystick by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FTKL_board-Joystick.cpp Source File

FTKL_board-Joystick.cpp

00001 #include "mbed.h"
00002 
00003 BusIn biJoy(p15,p12,p13,p16);     
00004 DigitalIn diFire(p14);
00005 
00006 BusOut doLeds(LED1,LED2,LED3,LED4);
00007 
00008 int main()
00009 {
00010     doLeds=0;
00011     
00012     while(1) {
00013         if (diFire) 
00014             {
00015             doLeds=0;
00016             } 
00017         
00018         if (biJoy==1)
00019         {
00020             doLeds=doLeds<<1;
00021             
00022             if (doLeds==16 ||doLeds== 0)
00023             {
00024             doLeds=1;    
00025             }
00026         }
00027         
00028           if (biJoy==2)
00029             {
00030             doLeds=doLeds>>1;
00031             
00032         
00033                     if (doLeds==16||doLeds==0)
00034                     {
00035                     doLeds=8;    
00036                     }
00037         }
00038             
00039         wait(0.5);
00040     }
00041 }