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
Joystick.h@1:c42a77267f7b, 2016-10-20 (annotated)
- Committer:
- csharer
- Date:
- Thu Oct 20 22:16:14 2016 +0000
- Revision:
- 1:c42a77267f7b
- Parent:
- 0:46523bf02e61
- Child:
- 2:893fd930d3fb
added comments ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
csharer | 0:46523bf02e61 | 1 | #ifndef _Joystick_h |
csharer | 0:46523bf02e61 | 2 | #define _Joystick_h |
csharer | 0:46523bf02e61 | 3 | |
csharer | 0:46523bf02e61 | 4 | #include "mbed.h" |
csharer | 0:46523bf02e61 | 5 | |
csharer | 1:c42a77267f7b | 6 | #define DEAD_ZONE 4 //size of the dead zone ...-3,-2,-1 [-2...0...+2] 1,2,3... |
csharer | 0:46523bf02e61 | 7 | |
csharer | 0:46523bf02e61 | 8 | class Joystick |
csharer | 0:46523bf02e61 | 9 | { |
csharer | 0:46523bf02e61 | 10 | public: //Function and variables go here |
csharer | 0:46523bf02e61 | 11 | Joystick(PinName pinA, PinName pinB); //Constructor |
csharer | 0:46523bf02e61 | 12 | float horizontal(void); |
csharer | 0:46523bf02e61 | 13 | float vertical(void); |
csharer | 0:46523bf02e61 | 14 | void setScale(float min, float max); |
csharer | 0:46523bf02e61 | 15 | |
csharer | 0:46523bf02e61 | 16 | private: |
csharer | 0:46523bf02e61 | 17 | AnalogIn horiz; |
csharer | 0:46523bf02e61 | 18 | AnalogIn vert; |
csharer | 0:46523bf02e61 | 19 | |
csharer | 0:46523bf02e61 | 20 | float _min, _max; //Min and Max for scaling |
csharer | 0:46523bf02e61 | 21 | float rawMinH, rawMaxH, rawMinV, rawMaxV; //Max/Min raw values we have seen so far |
csharer | 0:46523bf02e61 | 22 | float raw_hc, raw_vc; //Raw Center values |
csharer | 0:46523bf02e61 | 23 | }; |
csharer | 0:46523bf02e61 | 24 | |
csharer | 0:46523bf02e61 | 25 | #endif |