Created
July 24, 2021 07:26
-
-
Save dglaude/c8b1ff1e83cefab83bc622ff837e2db9 to your computer and use it in GitHub Desktop.
keypad simple test by @FoamyGuy found on adafruit Discord 23/07/2021
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keypad import Keys | |
import board | |
import time | |
pins = [board.BUTTON_A, board.BUTTON_B] | |
keys = Keys(pins, value_when_pressed=False, pull=True) | |
while True: | |
if keys.events.overflowed: | |
keys.events.clear() | |
event = keys.events.get() | |
if event: | |
if event.pressed: | |
print("{} was pressed".format(event.key_number)) | |
if event.released: | |
print("{} was released".format(event.key_number)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment