You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using raspi-gpio in a device control application. I have a digital output line that drives a relay, but I also want to read the current state of the output line to drive a status indicator. If I define the pin as an output, raspi-gpio can't read the state of the pin. If I set it up as an input, I can't write to change the output.
My interface allow multiple connections, so I don't want to simply set a value and keep track of it for status display. I also need to be able to read the state to know that another operator has changed the value.
Is there a reason why I can't read an output value? Am I missing something in the interface that will allow me to do this?
Bob Segrest
The text was updated successfully, but these errors were encountered:
Hi @BobSegrest. You cannot read a value from an output, or write a value to an input. That's a fundamental limitation on how GPIO works, and there's nothing we can do about it.
DigitalOutput instances do have a value property on them, which contains a cached copy of the last value written to it from that instance, but it sounds like this won't work for your application
The way to do this, given your application constraints, is to wire a second GPIO pin configured as an input to your existing GPIO pin configured as an output. You can then read this new input pin and get the value "on the wire."
I am using raspi-gpio in a device control application. I have a digital output line that drives a relay, but I also want to read the current state of the output line to drive a status indicator. If I define the pin as an output, raspi-gpio can't read the state of the pin. If I set it up as an input, I can't write to change the output.
My interface allow multiple connections, so I don't want to simply set a value and keep track of it for status display. I also need to be able to read the state to know that another operator has changed the value.
Is there a reason why I can't read an output value? Am I missing something in the interface that will allow me to do this?
Bob Segrest
The text was updated successfully, but these errors were encountered: