Monitor multiple inputs while running sequence

Suppose I wanted a sequence of events to take place if a push button was pushed. Ex. ( once press is detected, turn "a" on for three secinds, then turn off, then turn "b" on for five seconds, then turn off.) meanwhile, it needs to monitor a second push button as well that turns "c" on untill it is pushed again. How can this be done simultaneously? I understand the blink without delay tutorial, but how do you run the state changes for "a" and "b" in sequence, initiated by an input and still Monitor and execute the "C" loop?

Pseudo code of what Im thinking. All three IF statements should be able to be monitored and executed simultaneously.

how do you run the state changes for "a" and "b" in sequence, initiated by an input and still Monitor and execute the "C" loop?

There is no "C" loop. The state changes for "a" and "b" are managed by a state machine using millis() for timing and the "C" actions happen in loop() before or after the state machine.

See One Push Button Trigger 2 Pins - Programming Questions - Arduino Forum for an example of such a state machine

You may also get some ideas from the demo several things at a time

...R

Thanks guys! I looked at switch statements and that looks like what I needed :smiley: