Actually determine if water is present
This commit is contained in:
parent
b9a6194d56
commit
56342923ee
|
@ -5,11 +5,7 @@ class WaterSensor:
|
|||
|
||||
def __init__(self, pin):
|
||||
self.waterSensor = machine.ADC(pin)
|
||||
self.reading = self.waterSensor.read_u16()
|
||||
self.threshold = 2000
|
||||
|
||||
def takeReading(self):
|
||||
self.reading = self.waterSensor.read_u16()
|
||||
|
||||
def isWaterPresent(self):
|
||||
return self.reading > self.threshold
|
||||
return self.waterSensor.read_u16() > self.threshold
|
||||
|
|
Loading…
Reference in New Issue