We have a lot of functions that depend on while loop. After enable interrupts in one of these functions, we want to back beginning of the void loop()
.
Any help will be appreciated.
Thanks.
We have a lot of functions that depend on while loop. After enable interrupts in one of these functions, we want to back beginning of the void loop()
.
Any help will be appreciated.
Thanks.
You want to go right back to the start of the loop function, from the middle of the loop function?
If i have understand it correctly, that's just not a good design, you could ofcourse add some flags variables, and statements all the way to control the flow of the program.
A good and pretty scalable way is to use either this control structure:
void loop()
{
outcome = initStuff();
outcome = someRandomStuff();
if(outcome == false){return;}
outcome = finishingStuff();
}
Or my favorite way, write it very modular. So that you don't have to restart or teleport back to the start of the function. Obviously it's impossible for me to say how, since i don't know what you are programming, BUT make sure that you code so that initStuff() in my example really contains all of the needed functionality for initing everything. Therefore you could simply call that function instead of needing to start the whole loop over incase that you have some desirable functions to pass through there.