moenad
Posts: 3
Joined: Mon Sep 05, 2016 3:59 pm

No interrupt is being triggered with RPi.GPIO

Mon Sep 05, 2016 4:20 pm

I'm using interrupts for the following 2 cases.

The first one to run a function after the tact switch is being clicked. This is working perfectly, no issues.

The second one is a 24v connected to the raspberry pi via a voltage divider (24v to 3.3v voltage divider). The state by default is 1 because the 24v power source is on, when I turn off the power source, the state changes to 0 BUT no interrupt is being triggered. The only way to make it work is to poll every time in the loop. Is this normal? If so, why? and how can I make this work?

Thanks.

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: No interrupt is being triggered with RPi.GPIO

Mon Sep 05, 2016 5:37 pm

We really need to see a working script which shows the problem.

moenad
Posts: 3
Joined: Mon Sep 05, 2016 3:59 pm

Re: No interrupt is being triggered with RPi.GPIO

Mon Sep 05, 2016 6:38 pm

joan wrote:We really need to see a working script which shows the problem.
Really nothing special.

Code: Select all

GPIO.add_event_detect(SAFE_REBOOT, GPIO.FALLING, callback=utils.safe_reboot, bouncetime=500)
GPIO.add_event_detect(SAFE_SHUTDOWN, GPIO.FALLING, callback=_safe_shutdown, bouncetime=500)
The first one works fine, when I click the button the callback is called and the pi restarts. On the other hand, the second one doesn't work, by the default it's 1, when I turn off the 24v power source, the state changes to 0 but the function doesn't get called.

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: No interrupt is being triggered with RPi.GPIO

Mon Sep 05, 2016 7:28 pm

That's not a working script. It is a small snippet of a script.

We need a complete program we can run so that we know sufficient details to comment.

Return to “Advanced users”