def edge_detect(pin, event_callback, bounce):
    """Add detection for RISING and FALLING events."""
    import Adafruit_BBIO.GPIO as GPIO
    GPIO.add_event_detect(pin, GPIO.BOTH, callback=event_callback,
        bouncetime=bounce)
