Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from gpiozero import Button
- from time import sleep
- aBtn = Button(6)
- bBtn = Button(13, pull_up=False)
- def buTest(but):
- sleep(0.5) #adjust to your liking
- act = but.is_active
- if act:
- # long press action here
- print('Button {} long press'.format(str(but.pin)))
- else:
- #short press action here
- print('Button {} short press'.format(str(but.pin)))
- aBtn.when_pressed = buTest
- bBtn.when_pressed = buTest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement