Page 1 of 1

need to respond to output pin

Posted: Sat Nov 17, 2018 9:17 pm
by picandies
How can a program react quickly (milliseconds) to an output pin going high? The pin is being set high by another process.
I tried setting up a callback to detect the change, but I get an error that I need to make my output an input!

Code: Select all

GPIO.add_event_detect(14,GPIO.RISING, callback=my_pin_shadower)


Re: need to respond to output pin

Posted: Sat Nov 17, 2018 9:30 pm
by joan
You could use pigpio which doesn't care if the callback is on an input or an output.

Alternatively you could connect the output pin to a spare pin set as an input and monitor the input pin.

Re: need to respond to output pin

Posted: Sun Nov 18, 2018 2:27 am
by AnneRanch
I am not 100% sure how you code "reads" GPIO.
If you go to the BCM register level, you can monitor the pin level independently from pin function - input /output.
Since you use "callback" you could probably use BCM interrupt too.

Re: need to respond to output pin

Posted: Sun Nov 18, 2018 2:48 am
by picandies
I'm looking into the pigpio library, but am wondering where a solid tutorial (article, or step-by-step format) is located, for getting things generally set up & working.

I opened some of the code examples, but that's not really an explanation & very few comments are within. The pigrpio site itself seems to have a vast array of commands & their descriptions (a bit overwhelming)--which is good once, you have your feet on the ground & know what's going on. Looking for "pigpio tutorial101"