raspberry-pi-picothonny

Moving Joystick Up Causes Raspberry Pi Pico to Disconnect


I was following this guide: https://www.tomshardware.com/how-to/raspberry-pi-pico-joystick

Everything works as described and I'm getting the expected values except for when I move the Joystick up on the Y axis. Then I get this error:

PROBLEM IN THONNY'S BACK-END: Exception while handling 'Run' (ConnectionError: EOF). See Thonny's backend.log for more info. You may need to press "Stop/Restart" or hard-reset your MicroPython device and try again. Process ended with exit code 1.

I have the exact components described in the guide and all my solder joints on the pins are good. If I reset it will work again and return expected values except for Y axis up (any value below neutral which is about 33000).

I've searched for everything I can think of and can't find any mention of this problem from anyone else. I can't think what it would be.

Here is the program I'm running:

import utime
xAxis = ADC(Pin(27))
yAxis = ADC(Pin(26))
button = Pin(16,Pin.IN, Pin.PULL_UP)
while True:
    xValue = xAxis.read_u16()
    yValue = yAxis.read_u16()
    buttonValue= button.value()
    print(str(xValue) +", " + str(yValue) + " -- " + str(buttonValue))
    utime.sleep(0.1)

But it doesn't matter if a program is running or not. The second you move the stick up on the Y axis the Pico disconnects.

Any help would be greatly appreciated.


Solution

  • Sorted it. There was a miniscule filament of wire from a previous project that was shorting the Y axis pin to the adjacent Run pin. Due to time constraints for this project I had to just switch to a different ADC pin rather than repair the short. After switching pins everything is working great.