I agree with the comments made by PaulS. In addition:
#define On HIGH
#define Off LOW
You are using On and Off not only for your relay control, but also to control enabling the pullup resistors on the inputs, salt water control etc. Use:
#define RelayOn LOW
#define RelayOff HIGH
or the other way round, depending on the which relays you use. Then use RelayOn and RelayOff only in conjunction with the relay output pins, and use HIGH and LOW everywhere else (or define other on/off constants for particular input and output devices, if you want).
pinMode(i,INPUT);
digitalWrite(i,On);
Simpler to use:
pinMode(i, INPUT_PULLUP);
instead.
//set D11 through D16 as OUTPUTS and initialize to logic high
//which turns the relay off...logic low turns the relay on
for(int i = 11; i<17; i++)
{
pinMode(i,OUTPUT);
digitalWrite(i, Off);
}
Better to write the data before setting the pin to be an output, to avoid getting a negative going glitch when using active-low relays:
//set D11 through D16 as OUTPUTS and initialize to logic high
//which turns the relay off...logic low turns the relay on
for(int i = 11; i<17; i++)
{
digitalWrite(i, RelayOff);
pinMode(i,OUTPUT);
}
- Change:
Serial.println("Add Salt = True")
to:
Serial.println(F("Add Salt = True"))
and similarly everywhere else you print a string literal. It saves RAM, which is precious on an Arduino.