Christopher Foley
/
ESE519_WIFI_CONTROLLER
a
Fork of ESE519_Lab6_part1_skeleton by
Diff: Joystick_skeleton/Joystick.h
- Revision:
- 8:cc7eb86a4b2f
diff -r ca226305d28b -r cc7eb86a4b2f Joystick_skeleton/Joystick.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Joystick_skeleton/Joystick.h Wed Oct 24 21:02:19 2018 +0000 @@ -0,0 +1,25 @@ +#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 \ No newline at end of file