Conditional statement help

No worries! I just want to make things work! :slight_smile:

Silas, in regards to your example, I think I see your point now.

So here is my modified code. The loop is limited to 1 switch at the moment for simplicity. (My logic of adding stuff till it breaks or doesn't work!)

This works as said, but when I release switch 1, it doesn't turn off the outputs. I can't at the moment figure out why? What am I missing?

// Digital Input Pin Constants
const int S1 = 2;    // Float Switch 1
const int S2 = 3;    // Float Switch 2
const int S3 = 4;    // Manual Switch 1
// Digital Output Pin Constants
const int K1 = 8;    // Relay K1 - Solenoid for Tank 1
const int K2 = 9;    // Relay K2 - Solenoid for Tank 2
const int K3 = 10;   // Relay K3 - Solenoid for Manual Use
const int K4 = 11;   // Relay K4 - Water Pump Relay
// Variables
int curS;
void setup() {
  // Initialize the pins, define digital I/O Pin Use
  pinMode(S1, INPUT);
  pinMode(S2, INPUT);
  pinMode(S3, INPUT);
  pinMode(K1, OUTPUT);
  pinMode(K2, OUTPUT);
  pinMode(K3, OUTPUT);
  pinMode(K4, OUTPUT);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  Serial.begin(9600);
}

void loop() {

  if (digitalRead(S1) == LOW && curS == 0) 
  {
    Serial.print("Filling Tank 1");
    digitalWrite(K1, HIGH);
    delay(3000);
    digitalWrite(K4, HIGH);
    curS = S1;  
  }
  else if (digitalRead(S1) == HIGH && curS == 1) 
  {
    digitalWrite(K4, LOW);
    delay(3000);
    digitalWrite(K1, LOW);
    curS = 0;
  }
}