[Tony] has developed a method of using a state machine to validate keypad inputs. His method checks the commands character by character as they are entered in by a 16 button keypad. State machines are often used to break down complex problems into sequential tasks, making code development easier. While [Tony's] example uses the keypad, Arduino Uno, and a character LCD, the theory can be applied to numerous projects, such as this Dahlander motor switch.
As you see, state machines can be very versatile. Stick around after the break as we take a look at [Tony's] state machine and provide a brief explanation of how it all works.
The goal is to ensure a command is entered in to a system correctly – in this case it is being validated character by character with each key press. A state machine is used to achieve this goal. The command is:
XX = 1-99
HH = 0-24
MM = 00-59
# = Execute
Each value is considered a state. When the value is entered, it moves to the next state. So:
Be sure to check out [Tony's] project for more details and learn how he implements the above state machine in code.