Christopher Foley
/
ESE519_WIFI_CONTROLLER
a
Fork of ESE519_Lab6_part1_skeleton by
Joystick_skeleton/Joystick.h@12:ea030e3181d3, 2019-11-01 (annotated)
- Committer:
- hydroguy45
- Date:
- Fri Nov 01 18:52:45 2019 +0000
- Revision:
- 12:ea030e3181d3
- Parent:
- 8:cc7eb86a4b2f
Cleaned up the header
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hydroguy45 | 8:cc7eb86a4b2f | 1 | #ifndef _Joystick_h |
hydroguy45 | 8:cc7eb86a4b2f | 2 | #define _Joystick_h |
hydroguy45 | 8:cc7eb86a4b2f | 3 | |
hydroguy45 | 8:cc7eb86a4b2f | 4 | #include "mbed.h" |
hydroguy45 | 8:cc7eb86a4b2f | 5 | |
hydroguy45 | 8:cc7eb86a4b2f | 6 | #define DEAD_ZONE 2 //where values will be set to zero. [-2,+2] |
hydroguy45 | 8:cc7eb86a4b2f | 7 | |
hydroguy45 | 8:cc7eb86a4b2f | 8 | class Joystick |
hydroguy45 | 8:cc7eb86a4b2f | 9 | { |
hydroguy45 | 8:cc7eb86a4b2f | 10 | public: //Function and variables go here |
hydroguy45 | 8:cc7eb86a4b2f | 11 | Joystick(PinName pinA, PinName pinB); //Constructor |
hydroguy45 | 8:cc7eb86a4b2f | 12 | float horizontal(void); //Reads horizontal value of joystick |
hydroguy45 | 8:cc7eb86a4b2f | 13 | float vertical(void); //Reads vertical value of joystick |
hydroguy45 | 8:cc7eb86a4b2f | 14 | void setScale(float min, float max); //Set the scale of values |
hydroguy45 | 8:cc7eb86a4b2f | 15 | |
hydroguy45 | 8:cc7eb86a4b2f | 16 | private: |
hydroguy45 | 8:cc7eb86a4b2f | 17 | AnalogIn horiz; //horizontal pot in joystick |
hydroguy45 | 8:cc7eb86a4b2f | 18 | AnalogIn vert; //Vertical pot in joystick |
hydroguy45 | 8:cc7eb86a4b2f | 19 | |
hydroguy45 | 8:cc7eb86a4b2f | 20 | float _min, _max; //Min and Max for scaling |
hydroguy45 | 8:cc7eb86a4b2f | 21 | float rawMinH, rawMaxH, rawMinV, rawMaxV; //Max/Min raw values we have seen so far |
hydroguy45 | 8:cc7eb86a4b2f | 22 | float raw_hc, raw_vc; //Raw Center values |
hydroguy45 | 8:cc7eb86a4b2f | 23 | }; |
hydroguy45 | 8:cc7eb86a4b2f | 24 | |
hydroguy45 | 8:cc7eb86a4b2f | 25 | #endif |