Pin layout

The joystick has a total of 5 pins: power supply, ground, X-axis output, Y-axis output, and switch output pin.

joystick
Joystick Pin Details
GND Ground pin. Should be connected to the Ground of the circuit.
VCC Power supply pin (typically 5V or 3.3V ).
VRX The X-axis analog output pin varies its voltage based on the joystick's horizontal position, ranging from 0V to VCC as the joystick is moved left and right.
VRY The Y-axis analog output pin varies its voltage based on the joystick's vertical position, ranging from 0V to VCC as the joystick is moved up and down.
SW Switch pin. When the joystick knob is pressed, this pin is typically pulled LOW (to GND).