Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

Python • Re: Add a timer to GPIO input for RPi

$
0
0
Personally I would use the gpiozero library and the button hold_time parameter:

Code:

from gpiozero import Buttonfrom signal import pausedef say_hello():    print("Hello!")button = Button(26,hold_time=1)button.when_held = say_hellopause()
https://gpiozero.readthedocs.io/en/stab ... tml#button

Statistics: Posted by rpiMike — Tue Jun 25, 2024 9:02 am



Viewing all articles
Browse latest Browse all 4906

Trending Articles