Catégories
Arduino Programmation

State machine Arduino demo

The LED is either blinking or glowing, but not at the same time. This simple example is a use case for a state machine.

The video shows the led alternating between blinking and glowing using a StateMachine objet and two State inherited objects.

When it comes to program complex interactions with Adrduino, we may benefit from using state machines. This allows to separate the code needed to manage different states of the applications and easily switch from one stat to another.

The open source code is available on:
https://bitbucket.org/pierrerossel/state-machine-arduino-demo

Instructions to create your own states for your own Arduino sketches are provided in the README.