A simple “On-Off” state machine

Here is a simple state machine that includes a few of the concepts.

A simple state machine

From this drawing, we can see that

The machine basically functions as an on-off switch which turns a light on or off whenever it gets the “flick” event

Further reading