New answers tagged

0

You could do this, although waiting is a poor strategy. Interrupts may be a brute force way to overcome this, but there are better solutions. I suggest gpiozero.Button specifically https://gpiozero.readthedocs.io/en/stable/api_input.html#gpiozero.Button.when_pressed This will let you handle many more events with minimal overhead, avoiding all the ...


1

You need to design the structure of your script to support this usage. Generally wherever you have a time.sleep() you will need to replace that with a loop testing for an early completion signal. E.g. change def blink_slow(): GPIO.output(blueLED, GPIO.HIGH) sleep(3) GPIO.output(blueLED, GPIO.LOW) sleep(3) to something like SHORT_DELAY=...


Top 50 recent answers are included