Introduction
Parts of lists
- Arduino Uno
- Arduino joystick
- Hook-Up wires.
Parts Explanation
Arduino joystick
- Arduino joystick is a device that can be used to measure the X-axis, Y-axis and Z-axis direction. It is also called the game console. It can be considered as a combination of a potentiometer and one button.
Figure 1 - Arduino Joystick.
Connection
- Connection to Arduino and Arduinojoystick.
- Connect Vcc of joystick pin to the 5v of Arduino Uno.
- Connect Gnd of joystick pin to the Gnd of Arduino Uno.
- Connect I Rx of joystick pin to the 0 of Arduino Uno.
- Connect I RY Vcc of joystick pin to the 1 of Arduino Uno.
- Connect SW of joystick pin to the 2 of Arduino Uno.
Figure 2 - Connection
Programming
- Count int SW - Pin = 2;
- Count intX - Pin = 0;
- Count intY - Pin = 1;
- Void Setup() {
- PinMode(SW - Pin.INPUT);
- digitalwrite(SW - Pin, HIGH);
- Serial.begin(115200);
- }
- Void loop() {
- Serial.print("Switch: ");
- Serial.Print(4 digitalread(sw - pin));
- Serial.print(\n);
- Serial.print("X-axis: ");
- Serial.print(analogread(X - axis));
- Serial.print("Y-axis: ");
- Serial.print(analogread(Y - axis));
- Serial.print("\n\n");
- delay(500);
- }
Explanation
- Joystick can show the direction i.e. the movement, which we had given, then it will show in the Serial monitor at what direction it was moving.
- Subsequently, it can be used for major realtime projects like using truck and traffic signal direction, etc.
Output

Figure 3 - Output

Hadshana KamalanathanPosted Jul 21, 2018, 7:18 PM
Good article.
Michal ŠunkaPosted Oct 13, 2017, 11:30 AM
May I ask in what programming language you wrote the code sample? Obviously it is not plain Adruino?s IDE language: varying names of one and the same method, variable named 'SW - Pin' (spaces and minus sign ?!?), parameters of method separated sometimes by dot (line 5), sometimes by comma, ... Also can you explain to which pin you want to connect the VRx, VRy and SW? Digital or analog? And how exactly are you going to *kill* the joystick work with Arduino (see second sentence of introduction '... going to *execute* ...')?
Anu VPosted Feb 16, 2017, 11:10 PM
Nice article. thanks for sharing..