Go Down

Topic: Effect of Returning from loop() (Read 1 time) previous topic - next topic


If I return from the required loop()   function ,  Does the System automatically re run the function, or will the system stall.

I have a piece of code in a new loop1()  using Scheduler.   The code calls a return; on any config failures.   I would hope the loop1() will just repeat.

Is this a correct assumption?


I believe I got my answer for main.cpp
nt main(void)

#if defined(USBCON)
   for (;;) {

      if (serialEventRun) serialEventRun();
   return 0;


Right.  loop() will get called over and over.  Your new function loop1() will only be called if you call it.  Returning from it will return to wherever you called it from. 
|| | ||| | || | ||  ~Woodstock


Ahh. But with the Due, There is a Scheduler library.   This loop1 is a secondary loop. ( Multitasking)

Will this loop be  called again like the Main loop?


Oh, you didn't say Due.  I don't know about Due.

But if it uses that same main.cpp then I would assume no since that main() doesn't ever call anything called loop1().
|| | ||| | || | ||  ~Woodstock


Sorry for not being clear about the Due.

I would hope that the Scheduler library would handle the loop.

I will dig into this.
Thanks for your reply.


Sorry for not being clear about the Due.
The Due has its own forum section.
Would you like me to move this thread there?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.



Ran some tests at it appears that the secondary loops do in fact repeat  after a return.

Go Up