lorawan/sodaq_one/water.ino
2016-11-14 11:01:40 +01:00

26 lines
360 B
C++

#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;
}