Because the joystick is moved, the potentiometers’ resistance variations, leading to various voltage levels which can be go through by a microcontroller or other processing unit. Observe that this instance assumes that you are applying an Arduino-compatible board that supports the Joystick library, such as the Arduino Leonardo or Micro. https://messiahmesfr.onesmablog.com/joystick-controller-secrets-79102402