Raspberry Pi jumper

This is a strange question, but I just want to see if it's possible.

Basically, would I be able to safely connect the 3.3 or 5v cable to another GPIO pin as a sort of jumper? So for example, if if the cable is not connected, a script will not run, however if the pin is connected to another 3.3v/5v output on the Pi, run that script?

• What do you mean by "the 3.3 or 5v cable"?
– joan
Jul 30, 2015 at 13:41
• You are possibly referring to a button circuit with a very crude button. Jul 30, 2015 at 15:02

You would probably need a small resistor to make the current flow, and most of all, use 3v3 only! Using 5v0 on any GPIO pin could fry your PI. If you find any tutorial with how to make buttons work on the internet, then changing button to a normal cable would do the trick. Also other end could be connected to different power source then PI 3v3 pin.

• Why would you need a resistor "to make the current flow"? It's my understanding that the resistor in a button circuit is to stabilize the input one way or another while the circuit is open (otherwise its value will float between high and low). Jul 30, 2015 at 15:04
• I'd say that's a diode :O I understood that shorted input pin with energy source will not detect voltage change, because there will be no current flowing (it does not pull the current) you need something to draw the current, like resistor or a diode Jul 31, 2015 at 16:01
• There's no short when you apply 3.3V directly to an input, and it will read high. The problem is when nothing is connected, it is in a high impedance state and may read as either above or below the threshold "on/off" voltage. Many of the GPIOs are in this state when you power the pi on... Jul 31, 2015 at 17:24
• ..The purpose of the resistor in the diagram you link isn't to draw the current, it is to protect the 3.3V from shorting to ground when the button is down. The state of the input when the button is open will be "on", when pushed, it will be "off" because the 3.3V will flow to ground. See here for more of an explanation. The term "pull-up" is confusing here; it's the 3.3V line that "pulls up", not the resistor, but the resistor is referred to as the "pull up resistor" because it's on the pull-up line. Jul 31, 2015 at 17:25

You must not connect 5V to a Pi gpio (unless your intention is to fry the gpio and/or Pi).

All the Pi's gpios are 3V3.

The 3V3 and 5V power rails have no method of knowing if something is attached.

A Pi gpio can read its input to detect if it is connected to 3V3 or ground.

• I think joan is implying that an alternative to a button circuit (involving a pull up/down resistor) would be to connect the wire from the input either to 3.3V ("on") or ground ("off"), i.e., not just 3.3V or nothing. Connected to nothing, an input's value will "float". Jul 30, 2015 at 15:08