519_La

Fork of Joystick_skeleton by Carter Sharer

Joystick.h

Committer:
csharer
Date:
2016-10-18
Revision:
0:46523bf02e61
Child:
1:c42a77267f7b

File content as of revision 0:46523bf02e61:

#ifndef _Joystick_h
#define _Joystick_h

#include "mbed.h"

#define DEAD_ZONE 2 //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