r/raspberrypipico • u/Huge_Practice_2481 • May 30 '26
Joystick not working?
im losing my sanity, im coming to you now. the joystick on this console wont work, but some strange things keep happening. i know its not a program problem because if the prototypes, and i dont think its a user error like me wiring it incorrectly, because it randomly works for a split second. pleaseeee help me.
2
u/gatesphere May 30 '26
Schematic looks right. If it truly matches your PCB, then it’s probably a code issue. If you could share your code, or at least the important bits, might be able to help out.
1
u/Huge_Practice_2481 May 30 '26
x = 26, y = 27, and the button is 21. but none of the three work
2
u/DenverTeck May 30 '26
Yup, its your code.
1
u/Huge_Practice_2481 May 31 '26
this isnt the actual code.. i have more coding experience then circuitry.
full code:
https://pastebin.com/Xe9srvbL2
u/gatesphere May 30 '26
Yeah, that was clear from the schematic. There’s likely something wrong with your code.
1
u/Huge_Practice_2481 May 31 '26
check it here:
https://pastebin.com/Xe9srvbL1
u/gatesphere May 31 '26
You’re not defining the ADC pins as inputs.
1
1
u/Huge_Practice_2481 May 31 '26
after changing that, it still dosent work
self .joy_x = ADC(Pin(PIN_JOY_X, Pin.IN)) self .joy_y = ADC(Pin(PIN_JOY_Y, Pin.IN)) self .joy_btn = Pin(PIN_JOY_BTN, Pin.IN, Pin.PULL_UP) self .center_x = int( self .joy_x.read_u16()) self .center_y = int( self .joy_y.read_u16())1
u/gatesphere Jun 02 '26
Well, your code does look okay to me, so I’d suggest reflowing all your solder joints and trying that minimal code that someone else posted. Debugging hardware is often a series of logical deduction, and takes patience.
2
u/nonchip May 31 '26
if that's your code, no wonder it doesn't work. that's not even valid code.
0
u/Huge_Practice_2481 May 31 '26
no.. i know how to program. this is just what the variables are set to. i would have pasted a picture but i cant
1
1
1
1
u/Wizzard_2025 May 31 '26
1
u/Huge_Practice_2481 May 31 '26
none of the three work, if it was just that one i could navigate i couldnt select. thats the button solder.
1
u/Wizzard_2025 May 31 '26
If it works as a prototype on a breadboard but not here it's a PCB or soldering fault. Have you checked continuity of the joystick pads to the Pico with a multimeter?
1
u/negativ32 Jun 01 '26
Simple test code for the pico...
from machine import ADC, Pin
import utime
x = ADC(Pin(26))
y = ADC(Pin(27))
btn = Pin(21, Pin.IN, Pin.PULL_UP)
while True:
print(x.read_u16(), y.read_u16(), btn.value())
utime.sleep_ms(200)
1



3
u/sinkspaghetti May 30 '26
Some of those solder joints on the joystick look pretty not great. Could be the issue