Hi I have the problem that I have a program which need a few seconds to run once through. It includes a few millis() and a stepper engine. it also has a start/stop button. the main problem is that the program only reads the button for a few milliseconds so it doesn't read the button if I press the button while the stepper is running. Basically I can start the program but I can not stop it. I am trying to create a parallel loop which runs the button. and one that runs the main loop. I assume it has something to do with protothreading. Has someone an idea how to do it? Thanks!
In what alternate universe do you imagine people helping you with code that you haven't shown them?
Well I was kind of hoping that someone once did something similar but I will upload the code later
Have a look at how the code is organized in Several Things at a Time
Note how each function runs very briefly and returns to loop() so the next one can be called. None of the functions tries to complete a task in one call. And there may be dozens of calls to a function before it is actually time for it to do anything.
Also look at the second example in this Simple Stepper Code