Creating multiple steps with buttons

I am trying to write a program that can go through several steps with button inputs and be able to restart at the beginning at anytime. Each step will turn on a LED or relay for x amount of seconds. I want to be able to push a button to go to each step. Each step will be different. I am new to programming, so I don't know much. I couldn't find anything on steps with buttons. I wrote one program, but it loops the same step over and over again. What can I do? Thank you!

ghunsberger:
I wrote one program

But you're not going to share it with us?

You should also give a better definition on what a "step" is.

Each step will perform a list of thing

  1. LED 0 is on at beginning of step

  2. Button is pressed and signal goes HIGH

  3. Turns on LED 1/relay for x seconds

  4. LED 1/relay turns off

  5. LED 2 turns on and waits til same button is pressed again.

  6. LED 2 is on at beginning of step

  7. Button is pressed and signal goes HIGH

  8. Turns on LED 3/relay for x seconds
    ...

This is what I am trying to do. I am not sure exactly how to do this. I thought about maybe writing a library. I looked up that idea, but I don't know how to start a library using the example I read.

int buttonState = 0;       // variable for reading the button status

void setup() {
  pinMode(7, OUTPUT);    // int LED as output
  pinMode(12, OUTPUT);   // int LED as output
  pinMode(11, OUTPUT);   // int LED as output:
  pinMode(2, INPUT);     // int button as input:
}


void loop(){                      // read the state of the pushbutton value:
  buttonState = digitalRead(2);   // check if the pushbutton is pressed.
                                  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {                  
    digitalWrite(12, HIGH);   // turn LED on
    delay(5000);              // wait 5s
    digitalWrite(12, LOW);    // turn off led
    digitalWrite(7, HIGH);    // turn relay on
    delay(15000);             // wait 15s
    digitalWrite(7, LOW);     // turn off relay
    digitalWrite(11, HIGH);    // turn LED on
    delay(10000);             // wait 10s
    digitalWrite(11, LOW);     // turn off led
 }
}

Start with "blink without delay", while your using delay() your never going to get what you want.

Mark