Actually determine if water is present

This commit is contained in:
Mike Cifelli 2023-02-07 12:43:28 -05:00
parent b9a6194d56
commit 56342923ee
1 changed files with 1 additions and 5 deletions

View File

@ -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