A comment on my blog asked about using multiple FSM's to simulate multi-tasking. This is a nice idea, but the FSM cannot control the timing in its current state.
For example, if you want a servo to spin for 3 seconds and during the same period have an LED blink 6 times, the client needs to keep track of the time. In a large sketch with a lot of multi-tasking, this would be cumbersome.
A possible solution is to add a function called add_timed_transition which takes a parameter stating how long the FSM stays in the given state before automatically transitioning to another.
A comment on my blog asked about using multiple FSM's to simulate multi-tasking. This is a nice idea, but the FSM cannot control the timing in its current state.
For example, if you want a servo to spin for 3 seconds and during the same period have an LED blink 6 times, the client needs to keep track of the time. In a large sketch with a lot of multi-tasking, this would be cumbersome.
A possible solution is to add a function called
add_timed_transition
which takes a parameter stating how long the FSM stays in the given state before automatically transitioning to another.