void setup() {
// here's where you setup the pin modes for your sensor, other inputs and outputs etc.
}
void loop() {
if (sensorValue() >= 400) wateringOff();
if (sensorValue() <= 200) wateringOn();
}
int sensorValue() {
int x = 0;
// where you read the pin value into x
return x;
}
void wateringOff() {
// where you do what you need to turn off the water
}
void wateringOn() {
// where you do what you need to turn on the water
)