Skip to content

Linted #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions adafruit_matrixkeypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ def pressed_keys(self):
pin.direction = Direction.INPUT
pin.pull = Pull.UP

for row in range(len(self.row_pins)):
for row, row_pin in enumerate(self.row_pins):
# set one row low at a time
self.row_pins[row].direction = Direction.OUTPUT
self.row_pins[row].value = False
row_pin.direction = Direction.OUTPUT
row_pin.value = False
# check the column pins, which ones are pulled down
for col in range(len(self.col_pins)):
if not self.col_pins[col].value:
for col, val in enumerate(self.col_pins):
if not val.value:
pressed.append(self.keys[row][col])
# reset the pin to be an input
self.row_pins[row].direction = Direction.INPUT
self.row_pins[row].pull = Pull.UP
row_pin.direction = Direction.INPUT
row_pin.pull = Pull.UP
return pressed