Programming L298N and Push Button Together

Hi guys, its my first post and i am a rookie in Arduino programming. I need help in incorporating 2 things into 1 program. First of all im running 2 peristaltic pump on L298N with my UNO. i made the pumps run a certain way and also try to put in a push button when its no running anymore but i cant get them both to work. It is either the PumpRun or the push button. How to i make it work together? firstly, i would like the PumpRun to run its course then have the ability to use the press button to turn on the pump when i need it to outside of the PumpRun. The sketch below allow me to run PumpRun but i cant seem to make the button work.

// Motor A

int enA = 9;
int in1 = 8;
int in2 = 7;

// Motor B

int enB = 3;
int in3 = 5;
int in4 = 4;

int button = 2;

int buttonState = 0;

void setup()

{

// Set all the motor control pins to outputs

pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(button, INPUT);
}

void PumpRun()

{

// Turn on motor A 1200ML

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
analogWrite(enA, 120);

// Turn on motor B 1400ML

digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
analogWrite(enB, 170);

// Set Duration of Motor Run

delay(360000);

// Now turn off motors

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);

delay(360000);

}

void loop()

{

PumpRun();

// read the state of the pushbutton value:

buttonState = digitalRead(button);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:

if (buttonState == HIGH)

{
// turn Pump on:

digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
analogWrite(enA, 120);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
analogWrite(enB, 170);

} else
{
// turn Pump off:

digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}

}

TIA.

Delaying for 360 seconds ( which is six minutes ) is a very bad idea because nothing can happen during that time, which is why push buttons are being ignored. Hold it down for 12 minutes and you will see the button code being done.

In fact any use of delay is going to stop anytime else from working for that amount of time.

Look at the blink without delay in the IDE to see how to get round this.
Or
See my
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html
Or Robin2's several things at once
http://forum.arduino.cc/index.php?topic=223286.0

Given that you are a first time poster why oh why did you not read Read this before posting a programming question ... - Programming Questions - Arduino Forum