Digital computers have a lot more power and flexibility to offer than processing simple difference equations like the kind that we have been looking at so far in our discrete cases. Computer systems are capable of handling much more complicated digital control tasks, and they are also capable of changing their algorithms in the middle of the processing time. For tasks like this, we will employ state-machines to allow us to dynamically control several aspects of a single problem with a single computer.
A state machine, in its simplest form, is a system that performs different actions, depending upon the state of the machine.
A state diagram depicts the different states of a state machine, and it uses arrows to show which states can be reached, and what are the conditions for reaching them.
Consider a common controls example of a movable cart that is attached to a horizontal pole. This cart, like the print-head on a printer, is free to travel back and forth across this pole at finite speeds. Dangling from the cart is a pendulum that is capable of freely spinning 360 degrees around its pivot point.