Struggling with basic GPIO input on Raspberry Pi Pico

Hey all,
I’m trying to read a button input on GPIO15 using MicroPython on the Pico, but it always returns “1” even when the button’s pressed. I’ve set it as Pin.IN with a pull-down, and wired it to 3.3V through the button. Not sure what I’m missing…bad wiring maybe?

Cheers for any tips!

1 Like

Hi @Donna294536

Welcome to the forum!

If you’re using an internal pull down* you won’t need to hook it up to 3.3V at all. You will be able to connect it up just it is in the photo below (using GPIO15 is fine).

*edit: A pull up would instead be required, not a pull down.

1 Like

@Dan, I might be missing something here…

If using an internal pull down, then with no button connected it should already be at ground. As such you would need to have the switch go Pin 15 → button → +3.3V to trigger a change in the pin state from ground to 3.3V when the button is pressed.

On the other hand if you used an internal pull-up, then the switch can then pull down to ground as per your image..

I assume this is a correct pin out for that part of the Pico

1 Like

The issue may exist in your code also. Please check that.

Are you sure you are using GPIO15 and not board pin #15? GPIO15 is board pin #20.

Does you code include some other functionality that might be using GPIO15, such as I2C or SPI?

Hi @Michael99645

No you’re not missing anything, I’ve had a human moment with that one, added an edit to the original post.

1 Like

@Donna294536
How did you go, did you find the source of your issue ?

If not, maybe supply the code used and a diagram of how you wired it.
Could be as simple as the pins on the button (if more then 2), so maybe buzz them out to ensure the chosen pins are connected via the button press.

Hello, If we take a look at the figure below it gives good reference to Pull UP and DOWN>

All models of Pi would be the same.

All the best.