For short, a finite state machine consists of states and transitions. A state consists of actions to be performed in that specific state. An example of an action could be the running state of a motor or an active loop for keeping a certain level in a tank. So the first thing to do, is to divide the machine in states, called “finite states”. To go from one state to another, transitions have to be made. A transition consists of one or more conditions and the actual transition to the new state (or states) to go to, when the conditions are true. As an example, when the level of a filling tank is rising above a certain level, the filling state must be stopped and the state for emptying is started. It is possible to go to one or more states from the active state, depending on the number of defined transitions. The theoretical Finite State model, is ideal for describing the finite state machine. The great benefit of using this way of making a control is the fact that in the finite state only the information of interest is processed. All other information will not influence the current state and is ignored.

In detail, the finite state sketch contains a lot of functions for handling possible conditions to start the next finite state. For example, pressing a button (rising or falling edge of an input), an analogue value passing a certain level (going over or under a certain value), or the expiration of a timer. Furthermore, the sketch contains functions for performing the actions, e.g. setting the outputs of the finite state. With the outputs it is possible to start a motor, open a valve, set a servo position or set analogue values (only PWM outputs). In the next chapters these functions are described.