Is there documentation for
RPi.GPIO? I have searched the web and can't find anything.
I know I can use
help() but this produces the following:-
wait_for_edge(...) Wait for an edge. Returns the channel number or None on timeout. channel - either board pin number or BCM number depending on which mode is set. edge - RISING, FALLING or BOTH [bouncetime] - time allowed between calls to allow for switchbounce [timeout] - timeout in ms
This is OK, in as far as it goes, but doesn't really explain. I assume the function blocks until the interrupt, but this is not stated. What are the limits/defaults for timeout?
I have the following code, which I start on boot. Pressing the button successfully shuts down, but I have noticed it also seems to shut down at other times.
I could add some code to verify the button push, or some circuitry to make it more robust, but though I would check the documentation first.
while True: # set an interrupt on a falling edge and wait for it to happen GPIO.wait_for_edge(INT, GPIO.FALLING) subprocess.call(['poweroff'], shell=True, \ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
I downloaded the source from SourceForge, which made things somewhat clearer, but the
timeout parameter seems to be missing in action.