BuffaloEngineer
Member
What's the best way to implement a finite state machine in a microcontroller? I have been using a switch statement to transfer between modes. That is, the switch statement is the bulk of main(), but it only executes code for the current state, and each case corresponds to a state.
Is it better (or more accepted) to put each state in a function? Or use another method altogether? Thanks!
Is it better (or more accepted) to put each state in a function? Or use another method altogether? Thanks!