def edge_detect(port, event_callback, bounce):
"""Add detection for RISING and FALLING events."""
import RPi.GPIO as GPIO
GPIO.add_event_detect(
port,
GPIO.BOTH,
callback=event_callback,
bouncetime=bounce)
文章目录