- Joined
- Nov 7, 2006
- Messages
- 9,656
- Helped
- 1,191
- Reputation
- 2,401
- Reaction score
- 1,219
- Trophy points
- 1,403
- Location
- Brazil
- Activity points
- 56,024
How to use state machine handling delays with flags?
By using state machine you would always return to an Idle state instead of being blocked within execution of a Delay function, in addition to the obvious advantage of having a better structured program. As you did, it is not any issue at all if blink two leds is the only thing you have to do but if you need to read for example a key pressed within 1s would not work, so it is time to you get introduced to better practices in coding; make a search on the Web for the keyword FSM ("finite state machice") and you will have insights to apply this approach on your programs.