519_La
Fork of Joystick_skeleton by
Diff: Joystick.h
- Revision:
- 0:46523bf02e61
- Child:
- 1:c42a77267f7b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Joystick.h Tue Oct 18 20:26:41 2016 +0000 @@ -0,0 +1,25 @@ +#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 \ No newline at end of file