Analog joystick-like devices used for example Controllers PlayStation second detection directions of traffic is carried by two potentiometers - one (4.7 k Ω ) on each axle. The device also has a button activated by pressing the knob .
To operate the device, all you need is a microcontroller with an analog-to-digital converter (analog input in Arduino ). The location information of the knob is transmitted through an analog signal, in which the voltage corresponds to the given position. Each axis has a separate analogue output. The state of the button is detected by a digital output which, when switched on, becomes low.
Using the joystick connection plate, it boils down to connecting the following pins:
VCC - Supply voltage (5 V).
GND - System weight.
VRx - Analog output for the vertical axis (in the middle position, the value equal to half the voltage supply VCC / 2).
VRy - Analog output for the horizontal axis (in the middle position, the value equal to half the voltage supply VCC / 2).
SW - The digital signal of the button, when switched on, reaches the GND value, switched off - it is in the floating position - so you should add the pull-up resistor to the power supply.