Switch-based FSM with enum states.
Embedded firmware almost always reduces to one big state machine. Build one:
```c
typedef enum { IDLE, RUNNING, ERROR } state_t;
state_t step(state_t s, int event);
```
Rules:
- IDLE + event 1 → RUNNING
- RUNNING + event 2 → IDLE
- any state + event 99 → ERROR
- otherwise stay in the same state.
Implement `step` with a switch on `s`.Sign in to save your code and track progress across devices.