Skip to content

Commit

Permalink
Merge pull request #9 from FoamyGuy/read_pin_return_bool
Browse files Browse the repository at this point in the history
return bool from read_pin()
  • Loading branch information
FoamyGuy authored Jan 7, 2025
2 parents d3e5c4b + 82f8da9 commit 1552cb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion adafruit_pcf8574.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def write_pin(self, pin: int, val: bool) -> None:

def read_pin(self, pin: int) -> bool:
"""Read a single GPIO pin as high/pulled-up or driven low"""
return (self.read_gpio() >> pin) & 0x1
return ((self.read_gpio() >> pin) & 0x1) == 1


"""
Expand Down

0 comments on commit 1552cb6

Please sign in to comment.