Arduino sketch to build arduino code for a finite state machine
install FSM library https://github.com/kiwisincebirth/Arduino/tree/master/libraries/FSM
Run the sketch, enter the state machine and up to 10 states. enter "#" to generate code.
Copy code from serial monitor to a new sketch
Edit the state functions to create a functional state machine
The example ledFlasherExample.ino requires Metro library https://github.com/thomasfredericks/Metro-Arduino-Wiring