This example is a variation on the SIK circuit #5. Instead of two buttons and an LED, we use one button and an RGB LED.
sketch illustrates using a simple pushButton and an RGB LED to sequence through several program states using what is called a state machine.
Each time the button is pressed, a state variable is incremented. There is a nested if-else statement below that then does something different depending on the value of the state variable.
This is a very useful trick for creating menus, incrementing through steps, or controlling your projects.