user66296: I want to end loop at a specific time and start setup again. Is this possible? (I can explain reason in case you require).

user4143: Not directly, no. You can reboot the Arduino though so everything starts from scratch (either through the watchdog timer or wiring a GPIO pin to RESET and pulling it LOW), but if you find you need to do this sort of thing then you should rethink your methodology so that you don't need to do this sort of thing.

user7508: You could just call setup() yourself:
void loop() {
    if (some_condition) {
        setup();  // reinitialize everything
        return;
    }
    // etc.
}

But, as Majenko puts it, if you nee to do that it looks like there is
something wrong with your methodology.
That being said, it would be less suspicious if you only need to
reinitialize some specific part of your program. In this case you can
make a separate function for these initializations, and call it both
from setup() and, when needed, from loop():
void init_foo() {
    // ...
}

void setup() {
    init_foo();
    // other initializations...
}

void loop() {
    if (some_condition) {
        init_foo();  // reinitialize foo
        return;
    }
    // etc.
}


66296: <p>I want to end loop at a specific time and start setup again. Is this possible? (I can explain reason in case you require).</p>
 4143: <p>Not directly, no. You can reboot the Arduino though so everything starts from scratch (either through the watchdog timer or wiring a GPIO pin to RESET and pulling it LOW), but if you find you need to do this sort of thing then you should rethink your methodology so that you don't need to do this sort of thing.</p>
 7508: <p>You could just call <code>setup()</code> yourself:</p>

<pre class="lang-cpp prettyprint-override"><code>void loop() {
    if (some_condition) {
        setup();  // reinitialize everything
        return;
    }
    // etc.
}
</code></pre>

<p>But, as Majenko puts it, if you nee to do that it looks like there is
something wrong with your methodology.</p>

<p>That being said, it would be less suspicious if you only need to
reinitialize some specific part of your program. In this case you can
make a separate function for these initializations, and call it both
from <code>setup()</code> and, when needed, from <code>loop()</code>:</p>

<pre class="lang-cpp prettyprint-override"><code>void init_foo() {
    // ...
}

void setup() {
    init_foo();
    // other initializations...
}

void loop() {
    if (some_condition) {
        init_foo();  // reinitialize foo
        return;
    }
    // etc.
}
</code></pre>
