2 ms·
They are used extensively in embedded software. A device will be in one of several states - running, sleep, configuration, log download and so on. Each state is
by thebruce87m 3y ago
They are used extensively in embedded software. A device will be in one of several states - running, sleep, configuration, log download and so on. Each state is a C function (for me). I normally have entry/exit functions for each state too so that you set up/tear down the hardware needed for each.
As you add more states, you do not need to edit the existing states - well only the bits where you need to transition to the new state. This makes it much easier to maintain and reason about.
Each subsystem can be its own state machine too.