From 56342923ee58cf5bdfc5e95359aff307f91a0a05 Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Tue, 7 Feb 2023 12:43:28 -0500 Subject: [PATCH] Actually determine if water is present --- sensors/watersensor.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sensors/watersensor.py b/sensors/watersensor.py index 32c25e5..3ea33f7 100644 --- a/sensors/watersensor.py +++ b/sensors/watersensor.py @@ -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