Wikipedia: A programmable logic controller (PLC) is a digital system used to make electrical and mechanical processes become automated. PLC’s can be found in almost all of the installations which require process states and sequences. PLC’s contain (or are connected with) an unique set of inputs and outputs. The Arduino boards can be categorized as simple PLC’s. Programming the Arduino board with the theory of the FSM, is a good base for building controls.
The Arduino is programmed[1] by a subset of C/C++ structure text language. Knowledge of C/C++ is required to understand the following chapters where declarations and functions are described. I decided not writing a special FSM library, simply because it don’t add any functionality, it only shortens the code of the sketch. Mean while i have put the code of the Finitie State machine and the code of the configuration in seperate *.h files; UserFiniteStateMachine.h and UserConfiguration.h

[1] Wikipedia: “Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal, on which it is based. All of the languages share IEC61131 Common Elements“.