I have had a look around and no one mentions anything about this.

Is it possible to change the value of a GPIO set up as input pin via "software" terminal or something like that?

The reason is I want to test, debug some scripts that use the GPIO for input purposes and I was wondering if there was a way to change the values on the input by software. I supposes it would make to much sense to have this functionality other that this one and is that kind of thing that it could cause more issues than not, but would be interesting to know.

Other than connection another system that I can program to the input I cant think of anything else, appart from maybe there some "obscure" stuff under the hood of the GPIO "controller"

2 Answers 2


If a pin is input it (should) reflect the value of whatever is connected to it. It would make no sense otherwise.

If you want to test you could set some other pin as output and connect them. This could be an unused pin on the same or a different system.

  • It's certainly simplest to connect another GPIOo to the GPIOi under test with a wire and then write to GPIOo.
    – joan
    Jul 30, 2016 at 8:26
  • ah! another Pin on the same board! boom! how didnt I think of that... :S thanks
    – maco1717
    Jul 30, 2016 at 16:35
  • That's exactly what we do with the (partially complete) "real pin" tests in the gpio-zero library; we assume 22 and 27 are wired together (selected because they're present on all models, have no built-in pull-ups, or aux functions, and are adjacent so it's easiest to just jumper them) then set one as an input and "do stuff" with the other one (set it as output, toggle it on and off, set it as input and pull it up, etc. etc.)
    – Dave Jones
    Jul 30, 2016 at 18:15

You could simply set the pin you want as output, set the value you want whenever you want, and then just read from it. It's safe and valid to read the value of an output.

However, you can only do that safely as long as you don't have any other source connected to that pin. Two outputs shorted together will most likely not end well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.