Since our code is based on lab 6 code and we also used the joystick to test movement initially. So joystick still existed tough we haven't use that eventually

Fork of Joystick_skeleton by Carter Sharer

Joystick.h

Committer:
csharer
Date:
2016-10-20
Revision:
1:c42a77267f7b
Parent:
0:46523bf02e61
Child:
2:893fd930d3fb

File content as of revision 1:c42a77267f7b:

#ifndef _Joystick_h
#define _Joystick_h

#include "mbed.h"

#define DEAD_ZONE 4 //size of the dead zone  ...-3,-2,-1 [-2...0...+2] 1,2,3...

class Joystick 
{
    public: //Function and variables go here
        Joystick(PinName pinA, PinName pinB); //Constructor
        float horizontal(void);
        float vertical(void);
        void setScale(float min, float max);
        
    private:
        AnalogIn horiz;
        AnalogIn vert;
        
        float _min, _max; //Min and Max for scaling
        float rawMinH, rawMaxH, rawMinV, rawMaxV; //Max/Min raw values we have seen so far
        float raw_hc, raw_vc; //Raw Center values
};

#endif