Using A PushButton with a Relay SHIELD

Hi Folks,

Let me first admit, i'm a n00b. I've taken a circuits class and an electro-mechanical class but the progress I have made in 2 weeks has lead to the following...(The image show a quite rudimentary illustration of how i've set up my stuff: The relay shield is obviously sitting atop the Arduino)

What i'm trying to do is implement the pushbutton somewhere on the breadboard so that when it is engaged, I can activate the code I already have that regulates the Spring and Solenoid.

Below i'll provide my revised code, please let me know if you see any glaring mistakes that should provide a quick fix.

int Relay_2 = 2;
int Relay_3 = 4;

//Pin 8 is Relay 0, Pin 7 is Relay 1, Pin 2 is Relay 2,
//Pin 4 is Relay 3

int Spring = 8;
int Vac = 7;

int Button = 19; //These initial values are for the
int buttonState = LOW; //button only.

void setup()
{
pinMode(Spring, OUTPUT);
pinMode(Vac, OUTPUT);
pinMode(Button, INPUT);

}

void loop()
{
buttonState = digitalRead(Button);

if (buttonState == HIGH) {
digitalWrite(Spring, HIGH);
delay(3500);
digitalWrite(Spring, LOW);
digitalWrite(Vac,HIGH);
delay(3500);
digitalWrite(Vac,LOW);
} else {
digitalWrite(Spring, LOW);
digitalWrite(Vac, LOW);
}
}

N.B. since the relay shield is attached to all of the available pins I assumed 19 was free for usage.

Initialising the buttonState is pointless as it takes the value in the loop().

You have not indicated how the switch is connected. They are normally connected to the input and gnd. There is also a pull up R from the input to 5v. This can be a physical 10k of invoke the internal pull up.

With the switch as above, it will normally be HIGH until the switch is operated.

Weedpharma