A simple “On-Off” state machine
Here is a simple state machine that includes a few of the concepts.
From this drawing, we can see that
- This machine has two states, On and Off
- it transitions between them whenever it gets the flick event (that’s the two arrows between the states)
- The “on” state has some actions that happens when it enters or exits that state.
The machine basically functions as an on-off switch which turns a light on or off whenever it gets the “flick” event
- A more advanced on-off switch — adds more features to this simple switch logic