@@ -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