Program your own Finite State Machine using a SPLat Controller for only $29.00.
The EC1 "EasyOne", a 32-bit fully featured SPLat Controller with USB and true multi-tasking is a easy way to learn and a cheap way to build your project.
Re-cap and re-group
That pretty much covers the basics of state diagrams. A state diagram lets you design the logic of a Finite State Machine (FSM). FSMs are an excellent tool for desiging programs that must respond to external events in a way that depends on past history (the context).
The key elements of a state diagram are:
- The circle represents a place where the program is waiting for an event. While it waits the outputs are unchanging. We call this a state.
- There can be more than one event being waited for in a state
- When an event takes place the state machine exits the state and transitions to a new state. (It can actually transition to the same state, repeating any entry actions)
- During the transition to a new state certain actions may be performed. These actions are the useful output of the FSM.
- States can have timeouts that "fire" if none of the expected events occur within a set time limit.
Next, I will show you how a Finite State Machine can be coded in a couple of languages.