Here is a sketch to illustrate what I meant in the previous post. I changed the state change example to work with an active LOW (LOW when pressed) switch. Make a function for each of your sequences to be called by the cases or insert sequence code in the cases.
const int buttonPin = 3;
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (buttonState != lastButtonState)
{
if (buttonState == LOW)
{
buttonPushCounter++;
}
lastButtonState = buttonState;
}
switch (buttonPushCounter)
{
case 1:
// callsequence one
break;
case 2:
// callsequence two
break;
case 3:
// callsequence three
break;
case 4:
//reset button push counter after 3 sequences. Zero is is the idle state
buttonPushCounter = 0;
break;
}
}