fix gpio read
This commit is contained in:
parent
b75b306726
commit
bd96ca95a6
10
sensors.py
10
sensors.py
|
@ -29,8 +29,16 @@ class GPIOState(Sensor):
|
|||
self.pin = pin
|
||||
self.transform = transform
|
||||
|
||||
self.value = GPIO.input(self.pin)
|
||||
self.update_time()
|
||||
|
||||
def update_time(self):
|
||||
self.time = perf_counter()
|
||||
|
||||
def read(self):
|
||||
return self.transform(GPIO.input(self.pin))
|
||||
self.value = GPIO.input(self.pin)
|
||||
|
||||
return (self.time, self.transform(self.value))
|
||||
|
||||
class Temperature1W(Sensor):
|
||||
def __init__(self, address):
|
||||
|
|
Loading…
Reference in New Issue