Carter Sharer / Joystick_skeleton

Dependents:   ESE519_Lab6_part1_skeleton

Fork of Joystick_skelleton by Carter Sharer

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Joystick.h Source File

Joystick.h

00001 #ifndef _Joystick_h
00002 #define _Joystick_h
00003 
00004 #include "mbed.h"
00005 
00006 #define DEAD_ZONE 2 //where values will be set to zero. [-2,+2]
00007 
00008 class Joystick 
00009 {
00010     public: //Function and variables go here
00011         Joystick(PinName pinA, PinName pinB); //Constructor
00012         float horizontal(void); //Reads horizontal value of joystick
00013         float vertical(void);  //Reads vertical value of joystick
00014         void setScale(float min, float max); //Set the scale of values
00015         
00016     private:
00017         AnalogIn horiz; //horizontal pot in joystick
00018         AnalogIn vert; //Vertical pot in joystick
00019         
00020         float _min, _max; //Min and Max for scaling
00021         float rawMinH, rawMaxH, rawMinV, rawMaxV; //Max/Min raw values we have seen so far
00022         float raw_hc, raw_vc; //Raw Center values
00023 };
00024 
00025 #endif