From 38a34e7edfc077e01426f3d802a659fa57aced1d Mon Sep 17 00:00:00 2001 From: Robert Wolterman Date: Tue, 7 Mar 2017 07:22:09 -0600 Subject: [PATCH] Updating the README to clean up how to do callbacks for more clarification on #62 --- README.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 0f98ba7..1fc7611 100644 --- a/README.rst +++ b/README.rst @@ -246,13 +246,15 @@ CHIP_IO can also handle adding callback functions on any pin that supports edge print("we hit the edge we want") GPIO.setup("GPIO3", GPIO.IN) - # Add Callback: Falling Edge - GPIO.add_event_callback("GPIO3", GPIO.FALLING, mycallback) - # Add Callback: Rising Edge - GPIO.add_event_callback("GPIO3", GPIO.RISING, mycallback) - # Add Callback: Both Edges - GPIO.add_event_callback("GPIO3", GPIO.BOTH, mycallback) - # Remove callback + # Add Event Detect and Callback Separately for Falling Edge + GPIO.add_event_detect("GPIO3", GPIO.FALLING) + GPIO.add_event_callback("GPIO3", mycallback) + # Add Event Detect and Callback Separately for Rising Edge + GPIO.add_event_detect("GPIO3", GPIO.RISING) + GPIO.add_event_callback("GPIO3", mycallback) + # Add Callback for Both Edges using the add_event_detect() method + GPIO.add_event_detect("GPIO3", GPIO.BOTH, mycallback) + # Remove callback with the following GPIO.remove_event_detect("GPIO3")