Class JoystickAxis - GSTCH/SketchMadeEASY GitHub Wiki

Input JoystickAxis

Topic Specification
Description Represent a joystichAxis. This is a variable (analog input) with auto calibration during startup. Value=0 is the centre position, value itself is +/-255.
In the middle there is a dead zone where all changes are ignored
To filter the smallest changes, there is the ConsideredMinChange parameter. Changes less than or equal to this value are suppressed.
Constructor JoyStickAxis (int AnalogPin, bool SwitchDirection, int DeadZoneWidth, int ConsideredMinChange)
Parameter
AnalogPin: Analog Pin number
SwitchDirection: Swap the sign
DeadZoneWidth: Optional with default 20. Radius of a zone near the middle where the value is 0. Value in the resolution of the analog pin.
ConsideredMinChange: Optional with default 5. The logic ignores changes less than or equal than this value.
Range -255 … 255
Samples JoyStickAxis* joystickAxis= new JoyStickAxis(A0, true);
JoyStickAxis* joystickAxis= new JoyStickAxis(A1, false, 10);
JoyStickAxis* joystickAxis= new JoyStickAxis(A2, false, 10, 8);
Examples 12‐Servo360 controlled by a Joystick
18 ‐ Stepper angle controlled by joystick
⚠️ **GitHub.com Fallback** ⚠️