![Joystick Module (4 Directions)](http://store.fut-electronics.com/cdn/shop/products/joystick_4directions_grande_bb812e94-e739-4073-920d-534640e3d301_1024x1024.jpg?v=1439745053)
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