Funeral Home Curtain closer code (Solved)

Hi all - I'm back to irritate you all with my unconventional coding.

This time I have, what is hopefully a simple problem:

I can get this to pull pin 8 low, but not pin 7
Using an Uno Clone, with pins 5 and 6 pulled to ground with 9.1 k resistors
Internal pullups enabled.
The idea is that when trigger switch is closed, pin is pulled to ground.
That will drive curtains one one direction.
Both relays CANNOT be closed under any circumstances.

Hoping I have made a newbie mistake somewhere, and I have tried to clean up and notate my code carefully to help you guys follow my messy thinking:

/*
------------------------------------------------------------------------------------------------------------------
This code was originally designed for a digispark, hence the funky pin numbering.
This is an updated code as of 25-6-2020 by ****** designed to run on a Duinotech UNO
To run curtain control for funeral home
Both relays CANNOT be on at the same time or big sparks.
3 relays are used, one for open, and another for closed (they swap polarity of motor)
one pin (onboardled) was used to hold a relay open during boot to avoid accidental shorts before boot.
Now shifted to a dedicated pin.
------------------------------------------------------------------------------------------------------------------
This code assumes the following:
Pins 0 and 2 and connected to pushbuttons that will pull them low momentarily when triggered.
Pins 3 and 4 are outputs that are nominal high (relay open) and will go low intended to drive relay outputs.

Pin 5 is a reset pin used by the bootloader on digisparks, and was avoided for this reason.
-------------------------------------------------------------------------------------------------------------------
*/
const int buttonPin0 = 6;     // the number of the pushbutton pin
const int buttonPin2 = 5;     // the number of the pushbutton pin
const int relayPin3 = 8;     // the number of the relay pin (Normally open)
const int relayPin4 =  7;     // the number of the relay pin (Normally open)
const int onboardLED = 12;     // the number of the onboard LED pin. (Normally closed) (shifted to 12 for testing and attached to 3rd relay)
int buttonState0 = 1;         // variable for reading the pushbutton status
int buttonState2 = 1;         // variable for reading the pushbutton status

void setup() {
  // initialize the relay pin as an output: 
  digitalWrite(onboardLED, LOW); //turn on relay 1 to isolate inputs until boot complete
  pinMode(relayPin3, OUTPUT); //set pins used for relays as outputs
  pinMode(relayPin4, OUTPUT); //set pins used for relays as outputs
  pinMode(onboardLED, OUTPUT); //set pins used for relays as outputs
  pinMode(buttonPin0, INPUT_PULLUP); // initialize the pushbutton pin as an input using internal 20k pullups.
  pinMode(buttonPin2, INPUT_PULLUP); // initialize the pushbutton pin as an input using internal 20k pullups.
  delay(1000); //wait a sec, safety to avoid relay arc over and shorts.
  digitalWrite(relayPin3, HIGH); //set relay pins high (relay off)
  digitalWrite(relayPin4, HIGH); //set relay pins high (relay off)
}

void loop() {
  // read the state of the pushbutton value:
  delay(100);
  buttonState0 = digitalRead(buttonPin0);
//-------------------------------------------------------------------------------------------------------------------  
    // if button 2 is low and button 0 is high, turn on relay 4 (low trigger) - curtains open
  if (buttonState2 == LOW) {
    if (buttonState0 == HIGH) {
      // turn relay pin3 on, relay pin2 off on:
      digitalWrite(relayPin3, HIGH);
      digitalWrite(relayPin4, LOW); 
    }
  }
//-------------------------------------------------------------------------------------------------------------------  
  // if button 0 is low and button 2 is high, turn on relay 3 (low trigger) - curtains close
  if (buttonState0 == LOW) {
    if (buttonState2 == HIGH) {
      // turn relay pin2 on, relay pin3 off on:
      digitalWrite(relayPin3, LOW);
      digitalWrite(relayPin4, HIGH); 
    }
  }
//-------------------------------------------------------------------------------------------------------------------  
  //if both buttons pressed, ignore input and turn off both relays
  if (buttonState0 == LOW) {
    if (buttonState2 == LOW) {
      // turn relay pin2 off, relay pin3 off on:
      digitalWrite(relayPin3, HIGH);
      digitalWrite(relayPin4, HIGH);
      delay(250);
      digitalWrite(onboardLED, HIGH); // - turn off relay 1 to connect other relays (Normally closed)
    } 
  }
//-------------------------------------------------------------------------------------------------------------------  
  //if both buttons are high (normal state due to use of internal pull up), leave both relays off also.
  if (buttonState0 == HIGH) {
    if (buttonState2 == HIGH) {
      // turn relay pin2 off, relay pin3 off on:
      digitalWrite(relayPin3, HIGH);
      digitalWrite(relayPin4, HIGH); 
      delay(250); //wait a little bit to avoid arc over and shorts
      digitalWrite(onboardLED, HIGH); // - turn off relay 1 to connect other relays (normally closed)
    } 
  }
}

Missing...

 buttonState2 = digitalRead(buttonPin2);

Edit: plus you seem to be unaware of the “and” operator...

 if (buttonState0 == LOW && buttonState2 == HIGH) {

...not a problem of itself, but just so you know.

Awesome guys - that fixed it - another friend just tapped me on the shoulder and spotted that too.

Quickest fix yet - TY Muchly.

Edit: plus you seem to be unaware of the “and” operator...

if (buttonState0 == LOW && buttonState2 == HIGH) {

...not a problem of itself, but just so you know.
[/quote]

Yes I am somewhat unaware of this, have only used it a couple of times.
I have a number of languages shoved in my head, have not had time to get heavily into this one yet.

Thanks again