Is the Arduino 'loop()' just a 'while(true)' loop in disguise?
I'd like to be able to abort a series of data inputs and restart the main loop(). If it's just an ordinary C/C++ loop in disguise, then 'continue' aught to do it - right?
I guess I could just give it a try, but I thought I'd ask to make sure I was doing 'the right thing'!
Is the Arduino 'loop()' just a 'while(true)' loop in disguise?
No. The loop() function is just that - a function. It is called over and over, in an endless loop.
I'd like to be able to abort a series of data inputs and restart the main loop(). If it's just an ordinary C/C++ loop in disguise, then 'continue' aught to do it - right?
The "loop" is, as noted above, a function in an endless loop.
More specifically, it is implemented as:
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
So, returning from the function, as you can with any function, will just end continuing to the end of the while loop, as if loop() had gone to the end, thus repeating the loop() function call again.