beginer; need some help with relay shield code for a project

hello all, My name is Brad, thank you in advance for any help.
My Project is making a Plow control.
what I am trying to do is as follows;

arduino uno rv3 with relay shield.
using 4 momentary buttons to control relays.
I have done some code for the relays and seem to have each relay working on each button.
problem is when i go further to change code to make relays turn on the way i need is not working out.:frowning:

what im trying to do is button 1 is up
button 2 is for down
button 3 is for right
button 4 is for left

i am trying to combine ; ie when button 3(right) or button 4(left) is pressed i need it to turn on its respective relays as well as relay 1 (up). so push 3 and get 3 and 1. push 4 and get 4 and 1. after i get this worked out i need to set delays for relay 1(up).

I will add a pic of my board as well as my starting code that I have so far. I have tried multiple ways of doing this but keep getting relay 1(up) blinking instead of staying on like i wish...
please let me know if u need any further info.
again thanks so much for any help.

#define relay1 7
#define relay2 6
#define relay3 5
#define relay4 4

#define up 11
#define down 10
#define right 9
#define left 8

void setup() {
Serial.begin(9600);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(up, INPUT);
pinMode(down, INPUT);
pinMode(right, INPUT);
pinMode(left, INPUT);

}

void loop() {

if(digitalRead(up)==1){
Serial.println("up");
digitalWrite (relay1, HIGH);
delay(100);
}
else{
digitalWrite (relay1, LOW);
}
if(digitalRead(down)==1){
Serial.println("down");
digitalWrite (relay2, HIGH);
delay(100);
}
else{
digitalWrite (relay2,LOW);
}

if(digitalRead(right)==1){
Serial.println("right");
digitalWrite (relay3, HIGH);
delay(100);
}
else{
digitalWrite (relay3, LOW);
}

if(digitalRead(left)==1){
Serial.println("left");
digitalWrite (relay4, HIGH);
delay(100);
}
else{
digitalWrite (relay4, LOW);
}
delay(100);

}

Look at the StateChangeDetection example under Examples -> 02Digital -> StateChangeDetection
to see how to detect when a button changes. Extend it to check all 4 of your buttons, then apply the logic you want depending on which buttons are pressed

thank's for the reply, i will do some reading on that. I just realized that my att code was not working. so I have added my code on my page for you to see.

Regard's

How are your inputs wired ?

Do you have any pulldown resistors on them or are they floating at an unknown voltage ?
Look at using pinMode(pinNumber, INPUT_PULLUP); to activate the built in pullup resistors

I am using resistors.. 10K

bantech33:
I am using resistors.. 10K

How are they wired ?

my inputs are wired to pins 8,9,10,and 11. 5v to one pin on button the other going to inputs . each one has pull up 10k resistor to ground. sorry thought you could see in my attach pic of my board layout.