Here is the complete sketch that I had been attempting:
int ATOsolenoid = 3; //This is the output pin on the Arduino we are using
int FlushSolenoid = 4; //This is the output pin on the Arduino we are using
int lowEye = 7;
int highEye = 8;
#define EXE_INTERVAL_1 5000
#define EXE_INTERVAL_2 10000
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ATOsolenoid, OUTPUT); //Sets the pin as an output
pinMode(FlushSolenoid, OUTPUT); //Sets the pin as an output
pinMode(lowEye, INPUT);
pinMode(highEye, INPUT);
}
void loop() {
digitalRead(lowEye);
digitalRead(highEye);
digitalRead(ATOsolenoid);
bool waterIsLow = digitalRead(lowEye) == LOW;
bool waterIsHigh = digitalRead(highEye) == HIGH;
if (waterIsLow) {
digitalWrite(ATOsolenoid, HIGH);
}
if (waterIsHigh) {
digitalWrite(ATOsolenoid, LOW);
}
//Flush Solenoid
unsigned long lastExecutedMillis_1 = 0; // vairable to save the last executed time for code block 1
unsigned long lastExecutedMillis_2 = 0; // vairable to save the last executed time for code block 2
unsigned long currentMillis = millis();
if (digitalRead(ATOsolenoid == HIGH)) {
digitalWrite(FlushSolenoid, HIGH);
}
if (currentMillis - lastExecutedMillis_1 >= EXE_INTERVAL_1) {
lastExecutedMillis_1 = currentMillis; // save the last executed time
digitalWrite(FlushSolenoid, HIGH);
}
if (currentMillis - lastExecutedMillis_2 >= EXE_INTERVAL_2) {
lastExecutedMillis_2 = currentMillis; // save the last executed time
digitalWrite(FlushSolenoid, LOW);
}
}
Your diagram perfectly represents the ideal outcome of this - I will attempt @gcjr's switch/case here shortly and report back. I can't thank you enough for all of the help on this!