JOYSTICK:-
A joystick is an input device consisting of a
stick that pivots on a base and sends its angle
or direction data in the form of X,Y axis
coordinates.
Working of joystick:
The Analog Joystick is similar to two
potentiometers connected together, one for the
vertical movement (Y- axis) and other for the
horizontal movement (X-axis).
The joystick also comes with a Select switch. It
can be very handy for retro gaming, robot
control or RC. Joystick provides two values for
x-axis and y-axis which is changes from 0 to 1023 so following function use to read values from
joystick
X Value = analogRead(A0);
Y Value = analogRead(A1);
When the joystick is at the central position (default) then it gives values X=514, Y=514.
Following diagram shows the mechanism of the joystick along with its coordinates according to
direction.
Activity 8:- Reading data (x axis and y axis value) from joystick using Arduino and
displaying it on LCD.
Components required:-
1. Arduino Uno board 2.Arduino Shield