lorawan/sodaq_one/water.ino

27 lines
360 B
Arduino
Raw Normal View History

2016-11-14 10:01:40 +00:00
#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;
}