The joystick motion is detected through two potentiometer and a button. Two of the input value of potentiometer are respectively to show the user offset in the X and Y axis, and the type of offset is analog. The button is used to show whether the user push down button in the Z axis, its type is the digital quantity.
Therefore the control rod contain a total of three input interface which are used to connect X, Y, and Z.
Arduino souce code for using joystick