Joystick 5 Pin Module For Arduino
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. This ‘Joystick 5 Pin Module For Arduino’ is an analog joystick – more accurate and sensitive than just ‘directional’ joysticks – with a ‘press in to select’ button. Since it is analog (10k potential meters), you’ll need two analog reading pins on your microcontroller to determine X and Y. Having an extra digital input will let you read the switch.
Features:
- Working voltage: 3.3V – 5V
- Output: 2 Analog Output Digital Output
- PCB Included
How to connect and use Joystick 5 Pin Module For Arduino
Analog joysticks are basically potentiometers so they return analog values. When the joystick is in the resting position or middle, it should return a value of about 512. The range of values goes from 0 to 1024. It can be used for major real-time projects like using in truck and traffic signal direction, etc..
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.
Sample Code –
// Arduino pin numbers
const int SW_pin = 2; // digital pin connected to switch output
const int X_pin = 0; // analog pin connected to X output
const int Y_pin = 1; // analog pin connected to Y output
void setup() {
pinMode(SW_pin, INPUT);
digitalWrite(SW_pin, HIGH);
Serial.begin(115200);
}
void loop() {
Serial.print("Switch: ");
Serial.print(digitalRead(SW_pin));
Serial.print("\n");
Serial.print("X-axis: ");
Serial.print(analogRead(X_pin));
Serial.print("\n");
Serial.print("Y-axis: ");
Serial.println(analogRead(Y_pin));
Serial.print("\n\n");
delay(500);
}
Package List:
- 1 x Analog 2-axis Thumb Joystick with Select Button.
Arduino জয়স্টিক হল একটি ডিভাইস যা X-অক্ষ, Y-অক্ষ এবং Z-অক্ষের দিক পরিমাপ করতে ব্যবহার করা যেতে পারে। একে গেম কনসোলও বলা হয়। এটি একটি potentiometer এবং একটি বোতামের সমন্বয় হিসাবে বিবেচনা করা যেতে পারে।
working ok