from gpiozero import Button from signal import pause def say_hello(): print("Hello!") button = Button(2) button.when_pressed = say_hello pause()
The above code works nicely in when I run it in the terminal by
python ./button.py. It also works nicely in mu-editor in the first run in mu-editor. But when I stop the programme in mu-editor and rerun the same script, it prompts the error
RuntimeError: Failed to add edge detection. Am I wrong in some settings?