Skip to content

Commit 38a34e7

Browse files
committed
Updating the README to clean up how to do callbacks for more clarification on #62
1 parent f32733b commit 38a34e7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,15 @@ CHIP_IO can also handle adding callback functions on any pin that supports edge
246246
print("we hit the edge we want")
247247

248248
GPIO.setup("GPIO3", GPIO.IN)
249-
# Add Callback: Falling Edge
250-
GPIO.add_event_callback("GPIO3", GPIO.FALLING, mycallback)
251-
# Add Callback: Rising Edge
252-
GPIO.add_event_callback("GPIO3", GPIO.RISING, mycallback)
253-
# Add Callback: Both Edges
254-
GPIO.add_event_callback("GPIO3", GPIO.BOTH, mycallback)
255-
# Remove callback
249+
# Add Event Detect and Callback Separately for Falling Edge
250+
GPIO.add_event_detect("GPIO3", GPIO.FALLING)
251+
GPIO.add_event_callback("GPIO3", mycallback)
252+
# Add Event Detect and Callback Separately for Rising Edge
253+
GPIO.add_event_detect("GPIO3", GPIO.RISING)
254+
GPIO.add_event_callback("GPIO3", mycallback)
255+
# Add Callback for Both Edges using the add_event_detect() method
256+
GPIO.add_event_detect("GPIO3", GPIO.BOTH, mycallback)
257+
# Remove callback with the following
256258
GPIO.remove_event_detect("GPIO3")
257259

258260

0 commit comments

Comments
 (0)