My guess is that the potentiometers on your print have a joint plus and minus...
Unlike the two single pots in your fritzy.
Add a red wire and a black wire from pot 1 to pot 2 to mimic the copper tracks on your joystick print.
Hi! Welcome to the Forum.
I've simulated your code on Wokwi and it works. So, as @build_1971 suspects, it seems the problem is on the circuit.
Hi im sorry i dont understand where to wire this
Did you have a look on your joystick print?
At the side we cannot see on the picture? (In post #1)?
Your joystick module is uncommon to me. Even Googling "joystick module" images I was unable to find one similar to yours. It has 4 pairs of pins and we need to know which pins are they... (circled in yellow).
I can see 2 GND, 1 VD, 1 UA? What abou the others?
you can take the module out of the breadboard and take a picture of the bottom...
i fixed the GND issue but taking out the GND wire at the bottom right because i dont think i need two and now it doesnt shut off the board. however the circuit still doesn't function correctly now the LEDs dont turn on at all
i took that wire out
you said
L/R+ to VCC
L/R to A0
U/D+ to VCC
U/D to A1
GNDs to GNDs
that is how the wiring is currently set up
struggling to read the schematic so i dont know why its not working
thank you for so much help
still cant locate issue
how can i make it easier to read?
that blue wire is a disconnected error on my end the red wire goes into A3 not A5
This is my second post here as some issues were resolved and i wanted a fresh post for the remaining. I have rebuilt this circuit and rewrote the program multiple times and I cannot figure out what is wrong. I am fairly new to arduino and i am attempting to program this joystick to control four LEDs. I will attach schematics and other visual aids and paste my code here-
`// joystick pins
const int LRpin = A0;
const int UDpin = A1;
// variables for analog readings
int LR;
int UD;
// neutral readings for calibration
int LR_neutral;
int UD_neutral;
// red, yellow, green, blue LED pins
const int Rpin = 11;
const int Ypin = 10;
const int Gpin = 6;
const int Bpin = 9;
// LED brightnesses
int R;
int Y;
int G;
int B;
const int deadzone=10;
void setup() {
// put your setup code here, to run once:
// Initialize serial communication
Serial.begin(9600);
// get neutral readings for calibration
// make sure you are not touching the joystick when
// the program starts!
LR_neutral = analogRead(LRpin);
UD_neutral = analogRead(UDpin);
}
void loop() {
// put your main code here, to run repeatedly:
// read analog pins
LR = analogRead(LRpin);
Serial.println(LR);
UD = analogRead(UDpin);
Serial.println(UD);
if(UD>=UD_neutral+deadzone){ // joystick is up
B = 0; // blue LED off
R = map(UD,UD_neutral,1023,0,255);
}
else if(UD<=UD_neutral-deadzone){
R = 0; // red LED off
B = map(UD,UD_neutral,0,0,255);
}
else{
R = 0;
B = 0;
}
if(LR>=LR_neutral+deadzone){ // joystick is up
Y = 0; // blue LED off
G = map(LR,LR_neutral,1023,0,255);
}
else if(LR<=LR_neutral-deadzone){
G = 0; // red LED off
Y = map(LR,LR_neutral,0,0,255);
}
else{
G = 0;
Y = 0;
}
analogWrite(Rpin,R);
analogWrite(Ypin,Y);
analogWrite(Bpin,B);
analogWrite(Gpin,G);
}
`
Can you describe what issues you are seeing?
For these, you might want to take an average and compute the final value before assigning to LR and UD neutral. Try 5 samples and if you want more precision, go for 10.
- LEDs pins are outputs.
pinMode(Rpin, OUTPUT);
pinMode(Ypin, OUTPUT);
pinMode(Gpin, OUTPUT);
pinMode(Bpin, OUTPUT);








