Should the question be asked on programmers.stackexchange please just move it or notify me.
Imagine a program with the sole purpose to measure temperature with a sensor. There are two inputs, the sensor and the user (user can press an abort button).
When the program starts, certain conditions have to be met. Lets say the sensor must not have a temperature higher than x. If the condition is met, the program moves on to the next step, if not, the user is being told to make sure the condition is met.
Once it is met, the user is presented with the next thing to do, like "now stick the sensor into the object you want to measure". The program now measures. Assume this process requires more than a snapshot of the sensor but some rather complex filtering etc. Once certain criteria have been met, the user is being told what to do next.
At some point the user is being presented with the result. The user can decide at any point to abort the whole thing (go back to start or close).
Why im struggling with this is, what if at some point another step is introduced, or some step is removed but they will always follow the same workflow. Im in the beginning of a new program and i want to create a maintainable system.
Im not sure if a state machine is a good solution for this or if i completely misunderstood what a state machine is for or if there is a simpler solution.