There's nothing special about embedded projects either.I just want TS to understand that there is nothing special about state machine when applied to embedded application.
There's nothing special about embedded projects either.I just want TS to understand that there is nothing special about state machine when applied to embedded application.
True.There's nothing special about embedded projects either.
if state in range(60, 130):
doSomething()
if state >= 330
doSomethingElse()
If state in [POST, STARTUP, IDLE, PAUSED, SLEEP, FAULT]:
doSomething()
I was advised to design a state machine on the forum, I started to learn how to draw in this thread https://forum.allaboutcircuits.com/threads/button-state-machine-solved.182198/Agreed. Use enum to make the code easier to follow.
Here is a typical example of using enum in a state machine.
enum State {POST, STARTUP, IDLE, ARMED, TRIGGERED, RUNNING, PAUSED, SLEEP, FAULT};
Can you tell me what about post #18 did not answer this for you? I put a lot of effort into that and if it did not clearly answer your question for a specific reason then I would like to expound on it so that my efforts were not wasted. If your answer is simply tl;dr then I'm done here and I hope you never figure it out.I was advised to design a state machine on the forum, I started to learn how to draw in this thread https://forum.allaboutcircuits.com/threads/button-state-machine-solved.182198/
I can attempt to design state machine but still I do not understand what is specific use of it. this question is for me as i'm shooting in the air i don't know the target yet i'm firing
@strantor I think I'm thinking too much about this topic that I don't need at all. I will gain more knowledge as I go on writing programs for real world applications. A flowchart, state machine, tables, timing diagram are a tool that helps us to solve our problems. Overall we have to write program for our system, it is not necessary to use flowchart or state machine. But a newbie can have many advantages from using those toolCan you tell me what about post #18 did not answer this for you? I put a lot of effort into that and if it did not clearly answer your question for a specific reason then I would like to expound on it so that my efforts were not wasted. If your answer is simply tl;dr then I'm done here and I hope you never figure it out.
This is true for very simple systems. If the system has complex algorithm then it is good to draw some flowchart before starting code (sometimes also hardware) development to prevent future software issues and long debugging sessions due the conflicts in code.Overall we have to write program for our system, it is not necessary to use flowchart or state machine.