A library that simplifies the creation of finite state machines and streamlines the process of turning state diagrams into code. It encourages objects to have ownership of their state by allowing finite state machines to be held by other objects.
This library works in any C++11 supported environment, including Arduino compatible microcontrollers that have implementations of std::chrono, std::function and std::vector (eg. ESP32).
Examples of use are included in the library, they compile in the Arduino environment but show how the library can be used in general.
- Create state machines with any number of states and transitions.
- Define states with functions to call on entering and leaving a state, and to call repeatedly while in a state.
- Define transitions with functions to define behaviour on transition and triggers to cause them.
- Define transitions that will occur after a certain amount of time in a state.
- Create state machines within other objects.
- Check current state, and if in a particular state.