Perhaps I'm misunderstanding how this is to be used, but if I use your code above, but just trigger on a single GPIO.BOTH within the while loop, I get stuck in a continuous loop. I would have expected it to cycle the loop only when I press or release the button.
I ran some other tests. Any single wait_for_edge() in a loop starts a continuous loop as soon as the first matching edge is triggered. You have to wait for a different edge type in order for the first edge type to trigger again.
In my case, I really just want to trigger on falling to start a loop of code, but I need a way to reset it at the end of the loop without having to wait for rising again, since that might have happened while I was in the middle of the loop.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fix pushed to source code library. Will be in next release.
Bug found with the following code:
This produces a continuous output of:
Button 1 Pressed
Button 1 Released
Button 1 Pressed
Button 1 Released
Button 1 Pressed
...etc.etc...
See http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=88951
Have added fix to get it to ignore the initial edge when changing edges. Fix is in source code library.
Perhaps I'm misunderstanding how this is to be used, but if I use your code above, but just trigger on a single GPIO.BOTH within the while loop, I get stuck in a continuous loop. I would have expected it to cycle the loop only when I press or release the button.
I ran some other tests. Any single wait_for_edge() in a loop starts a continuous loop as soon as the first matching edge is triggered. You have to wait for a different edge type in order for the first edge type to trigger again.
In my case, I really just want to trigger on falling to start a loop of code, but I need a way to reset it at the end of the loop without having to wait for rising again, since that might have happened while I was in the middle of the loop.
Fixed in release 0.5.8
With 0.5.8-1, I get this now after one button press:
RuntimeError: Conflicting edge detection events already exists for this GPIO channel
No further button presses work. Should I open a new bug?