aquifer/sensors/watersensor.py

12 lines
231 B
Python

import machine
class WaterSensor:
def __init__(self, pin):
self.waterSensor = machine.ADC(pin)
self.threshold = 2000
def isWaterPresent(self):
return self.waterSensor.read_u16() > self.threshold