How Does Joystick Potentiometer controller Work ?
This compact joystick is an analog similar to the ‘analog’ joysticks on the PlayStation 2 controllers. It's made of two potentiometers of a 10k value each, one for X-axis and the other for Y-axis and a tactile button on the side for select which is activated when the joystick is pressed down.
B taper, 60% at the lever vertical position.
The two potentiometers are connected with a gimbal mechanism separating the horizontal and vertical movements. When in idle position, the handle is centered which means each potentiometer is in its center position or value. Back to axes notion, you can choose which potentiometer for which axis x or y randomly. In the picture above, you can see the way i chose my axes (for this example, the axes won't matter. You can choose any of the potentiometer to try the sketch).
As for the hardware connection, the middle pin of the potentiometer is for the analog data and the two others for power. It won't matter which pin would be connected to 5V or GND, it will simply affect the default data value a little bit but no change are necessary in the codes