0

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"

1

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.

| improve this answer | |
  • It's certainly simplest to connect another GPIOo to the GPIOi under test with a wire and then write to GPIOo. – joan Jul 30 '16 at 8:26
  • ah! another Pin on the same board! boom! how didnt I think of that... :S thanks – maco1717 Jul 30 '16 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 '16 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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