Joystick

Dependencies:   mbed

Fork of app-board-Joystick by Chris Styles

FTKL_board-Joystick.cpp

Committer:
Planinsec
Date:
2015-04-29
Revision:
1:6d189395a003
Parent:
main.cpp@ 0:0e4db18afd77

File content as of revision 1:6d189395a003:

#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);
    }
}