Change GPIO Both to Rising

Change how the GPI detection workes, so it only does things on the rising edge
This commit is contained in:
2025-11-19 11:19:57 +11:00
parent d0fd9a0c94
commit 1d7e56f837

View File

@@ -57,7 +57,7 @@ GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD) GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.add_event_detect(12, GPIO.BOTH, callback=button_callback, bouncetime=200) GPIO.add_event_detect(12, GPIO.RISING, callback=button_callback, bouncetime=200)
input("Press enter to quit\n\n") input("Press enter to quit\n\n")
GPIO.cleanup() GPIO.cleanup()