Thanks for Visiting here

😊Joystick project👧
in this post we will make an amazing project in which we will use 3 major par 1. arduino uno board 2. Joystic module 3. 4 LEDs
How it work :
First of fol we will talking about how it work . lets see
Joystic is mainly used for control direction of any object like forwarding direction downward direction leftward direction as well as right word direction,
but in this project, we don't move any object in any direction, in this project we will use different LEDs for different directions.
When joystic move left direction then left led will on, same as all 4 leds on according to the joystick movements.
first watch this project video then we will make this.
Let's make :
Components required :
1. Arduino Board
2. Joystick module
3. 4 LEDs
Wiring Part :
First do Connction of Joystick
JOYSIC | Arduino |
GND | GND |
+5v | +5v |
VRx | A0 |
VRy | A1 |
Then Do connection of LEDs
LEDS | ARDUINO |
Right | 6 |
Left | 4 |
Down | 5 |
Bottom | 7 |
All GND | gnd |
Coding part :
int right=6;
int left=4;
int bottom=5;
int up =7;
int x;
int y;
int value;
void setup()
{
Serial.begin(9600);
pinMode(right,OUTPUT);
pinMode(left,OUTPUT);
pinMode(up,OUTPUT);
pinMode(bottom,OUTPUT);
}
void loop()
{
x=analogRead(A0);
y=analogRead(A1);
Serial.print("X= ");
Serial.println(x);
Serial.print("Y= ");
Serial.println(y);
// for Up
if (x>=500 && y==1023)
{
Serial.println("Up Led is On");
digitalWrite(up, HIGH);
}else{
digitalWrite(up, LOW);
}
// for down
if (x>=500 && y==0)
{
Serial.println("DOWN Led is On");
digitalWrite(bottom, HIGH);
}else{
digitalWrite(bottom, LOW);
}
// for right
if (x==1023 && y>=495)
{
Serial.println("right Led is On");
digitalWrite(right, HIGH);
}else{
digitalWrite(right, LOW);
}
// for left
if (x==0 && y>=495)
{
Serial.println("LEFT Led is On");
digitalWrite(left, HIGH);
}else{
digitalWrite(left, LOW);
}}
Thanks for Reading 😊
stay safe keep learning