This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Can anyone send me an example of a code implementation of state machine in .c for microcontroller
Hi Pk!
This question is very generic. In general, a state machine could be a simple switch-case based program flow:
uint8_t state = 0; switch( state ) { case 0: { // Do something state = 1; break; } case 1: { // Do something if( something ) { state = 2; } else { state = 0; } break; } case 2: { // Do something state = 0; break; } default: break }
Dennis
Thank you Dennis,
I am attaching a S/w flow diagram
can you plz help me according to this file
**Attention** This is a public forum