Commit b90448e6 authored by Nico Schottelius's avatar Nico Schottelius

Add code for water leak detection

parent 355eb681
#include <Arduino.h>
void setupWater(int pin) {
pinMode(pin, INPUT);
}
boolean hasWater(int pin)
{
if(digitalRead(pin) == LOW) {
return true;
} else {
return false;
}
}
String getWater(int pin)
{
String tmp;
if(hasWater(pin)) {
tmp = "water=1";
} else {
tmp = "water=0";
}
return tmp;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment