def level2_rising(channel): sleep(0.005) if GPIO.input(two) == 1: print("NOTIFIED 2 RISING") waterLevelStatus("Water level at 2") GPIO.remove_event_detect(two) GPIO.add_event_detect(two, GPIO.FALLING, callback=level2_FALLING, bouncetime=5)
def level1_FALLING(channel): sleep(0.005) if GPIO.input(one) == 0: print("NOTIFIED 1 FALLING") waterLevelStatus("Water level at 1 falling") GPIO.remove_event_detect(one) GPIO.add_event_detect(one, GPIO.RISING, callback=level1_rising, bouncetime=5)