mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 12:53:22 +00:00
Updating the README to clean up how to do callbacks for more clarification on #62
This commit is contained in:
16
README.rst
16
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")
|
print("we hit the edge we want")
|
||||||
|
|
||||||
GPIO.setup("GPIO3", GPIO.IN)
|
GPIO.setup("GPIO3", GPIO.IN)
|
||||||
# Add Callback: Falling Edge
|
# Add Event Detect and Callback Separately for Falling Edge
|
||||||
GPIO.add_event_callback("GPIO3", GPIO.FALLING, mycallback)
|
GPIO.add_event_detect("GPIO3", GPIO.FALLING)
|
||||||
# Add Callback: Rising Edge
|
GPIO.add_event_callback("GPIO3", mycallback)
|
||||||
GPIO.add_event_callback("GPIO3", GPIO.RISING, mycallback)
|
# Add Event Detect and Callback Separately for Rising Edge
|
||||||
# Add Callback: Both Edges
|
GPIO.add_event_detect("GPIO3", GPIO.RISING)
|
||||||
GPIO.add_event_callback("GPIO3", GPIO.BOTH, mycallback)
|
GPIO.add_event_callback("GPIO3", mycallback)
|
||||||
# Remove callback
|
# 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")
|
GPIO.remove_event_detect("GPIO3")
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user