Basic state machine example