Push button going through states with different actions

Hello and welcome :slight_smile:

Increase buttonPushCounter anytime the button is pushed, and use the modulo operator to reset it when you want, only then, compare it's value with whatever you want (I prefer using switch instead of if)

buttonPushCounter ++;
buttonPushCounter %= 3;

switch (buttonPushCounter)
{
    case 0:
    {
        //whatever
        break;
    }
    case 1:
    {
        //whatever
        break;
    }
    //etc
}

Edit: I forgot to say that you need to intitialize buttonPushCounter to -1..or move the increment/modulo operations AFTER the switch.

Edit2: Actually your problem is because you use if .. if, instead of if .. else if.