Three implementations:
demo_switch.c
most basic, switch-based state machinedemo_functions.c
a little nicer on the eye with functions as state handlersdemo_functions_results.c
a more generic state machine framework with reconfigurable state transitions