Page 1 of 1

GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Posted: Thu Sep 05, 2019 3:14 am
by 40Alpha
I have no problem turning on and off pins on my rpi4 (using both gpio on the terminal and Gpiozero with python3) however when I connect a wire (which is connected to a switch) to the pin... it turns the pin output to 0. When I disconnect, it goes back to 1.

What is the deal here? When I take the connection and attach it to an always on 5V pin - the turns on!

Any thoughts?

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Posted: Thu Sep 05, 2019 5:24 am
by Imperf3kt
You didn't connect a GPIO pin with the 5v pin did you? Because that's certain death for a Pi.

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Posted: Thu Sep 05, 2019 10:25 am
by Burngate
I'm not sure I understand your description.
I have no problem turning on and off pins on my rpi4
... so you've set the GPIOs to ouput, and you can set them to 0 (gnd) or 1 (3v3) at will.
How are you checking they do what you want? A meter? a LED and resistor?
however when I connect a wire (which is connected to a switch) to the pin... it turns the pin output to 0.
... that is only useful if you set the GPIO to input
Are you using a different pin from the first ones?

Also, what's on the other end of the switch?

Re: GPIO pin turns off immediately when switch is connected, turns back on when disconnected

Posted: Thu Sep 05, 2019 3:13 pm
by pcmanbob
Hi.

Might I suggest you have a look at the physical computing guide for python https://projects.raspberrypi.org/en/pro ... -computing

this will guide you through connecting switches to gpio inputs and things like LED's to gpio outputs.