Analog Joystick
Two potentiometers and a button — read X, Y, and a press.
How it works
A thumb joystick module is just two potentiometers (one for the X axis, one for Y) plus a momentary push button under the stick. Each axis gives an analog voltage you read with analogRead — roughly 0–1023, sitting near 512 when centered.
The button (SW) is a simple switch to ground; read it with INPUT_PULLUP, where pressed = LOW.
Pins
- VRx
- X axis — to an analog pin (e.g. A0).
- VRy
- Y axis — to an analog pin (e.g. A1).
- SW
- Push button — to a digital pin (INPUT_PULLUP).
- +5V / GND
- Power.
Ratings
- Axes
- 2 analog (0–1023, center ~512)
- Button
- Active-LOW
Tips
- Center is rarely exactly 512 — add a small dead-zone in code.
- Use INPUT_PULLUP for SW; pressed reads LOW.