With a Pi 5 and using gpiozero the following code works ok with umpteen Hello lines from contact bounce.
from gpiozero import Button
def say_hello():
print("Hello")
button = Button(6)
button.when_pressed = say_hello
2 questions:
Reading the gpiozero specs I apparently can nominate a bounce time. I cannot work out the syntax for this.
How do you want me to show code in this post?
PS I indented the print(“Hello”) line but the spaces were stripped when I saved it.