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:
britneyd
Date:
2017-04-26
Revision:
5:8b41e2fc69f9
Parent:
2:893fd930d3fb

File content as of revision 5:8b41e2fc69f9:

#ifndef _Joystick_h
#define _Joystick_h

#include "mbed.h"

#define DEAD_ZONE 2 //where values will be set to zero. [-2,+2]

class Joystick 
{
    public: //Function and variables go here
        Joystick(PinName pinA, PinName pinB); //Constructor
        float horizontal(void); //Reads horizontal value of joystick
        float vertical(void);  //Reads vertical value of joystick
        void setScale(float min, float max); //Set the scale of values
        
    private:
        AnalogIn horiz; //horizontal pot in joystick
        AnalogIn vert; //Vertical pot in joystick
        
        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