First Program, Should be easy, Help

So this is my first program that I am writing. It seems like it shouldnt be that difficult but I am struggling.
Goal:
I want to have a push button start the program (I want to be able to push and release the button and then the rest of the program continues)
Once started a relay will come on making a pneumatic cylinder lower until a proximity sensor is triggered
At this point the 1st relay will turn off and second relay will come on causing the ram to raise for (x) seconds
after the delay both relays will turn off causing the ram to rest for (x)
Then relay 2 will turn back on and raise the ram all the way up
At this point I want relay 2 to remain on until the push button is pressed and released again at which point the program will restart.

So here is what I have so far.

const int lower = 13; // pin to lower cylinder
const int raise = 7; // pin to raise cylinder
int raisetime = 2000; // time cylinder raises once the sensor trips
int button = 2; // start button pin
int sensor = 3; // sensor pin
int buttonstate = 0;
int sensorstate = 0;
int rampause = 10000; // time ram pauses

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(lower, OUTPUT);
pinMode(raise, OUTPUT);
pinMode(button, INPUT_PULLUP);
pinMode(sensor, INPUT_PULLUP);
}

// the loop routine runs over and over again forever:
void loop() {
buttonstate=digitalRead(button); // push button starts loop
if (buttonstate == LOW)
{
sensorstate=digitalRead(sensor); // ram lowers till sensor=low
if (sensorstate == HIGH)
{
digitalWrite (lower,HIGH);
}
else
{
digitalWrite (lower,LOW); // when sensor=low ram raises
digitalWrite (raise,HIGH); // ram raises
delay(raisetime); // ram raises for raisetime
digitalWrite (raise,LOW); // ram stops
delay(rampause); // ram pauses for rampause
digitalWrite (raise,HIGH); // ram raises till button is pressed and released again
}
}
}

Seems like a push and release would involve a LOW and then a HIGH. It seems like you'd want to keep up with what buttonstate was last time through loop and compare to the new reading. You're looking for it being not pressed this time, but it was pressed last time.

Right now you're starting that process when you read LOW on the button no matter whether it just started being LOW or whether it has been low for eons.

Could you point me in the direction of how to do that?

sbveenker: Could you point me in the direction of how to do that?

I just did.

Try taking everything out except detecting the button press and release. Can you make an LED change state on a press and release?

Yes I can make the led light go on when the button is pressed but when I release it, it goes off. I can get the program to work as long as I'm holding the button during the whole program, but thats not what I want.

sbveenker: Yes I can make the led light go on when the button is pressed but when I release it, it goes off. I can get the program to work as long as I'm holding the button during the whole program, but thats not what I want.

Post that code.