<p>I have been using loop interrupts for a while, and not had an issue... until now. And it is driving me nuts.</p>

<p>My program has 2 main loops, titled "touch" and "end" with two more nested in the "touch" loop, both titled "01"- these are just for turning with the gyro. I've attached pics so you can see this in detail.</p>

<p>The problem loop is the "touch" loop - the main nested one. I have a separate thread running to check the state of a switch. When it is pressed, I have a loop interrupt for the "touch" loop only. Since it is nested, and I only have one loop interrupt, I would expect it to pick up with the "end" loop and start over... but instead it ends the program, as if I interrupted both "touch" and "end".</p>

<p>I'm obviously missing something here... anyone with ideas, please speak up.</p>

<p><a href="https://i.sstatic.net/18Hu5.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/18Hu5.jpg" alt="Full program"></a><a href="https://i.sstatic.net/waoxK.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/waoxK.jpg" alt="Start"></a><a href="https://i.sstatic.net/bSonS.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bSonS.jpg" alt="End"></a></p>

CC BY-SA 3.0
2018-04-10T09:27:57.167Z
Is the code after the "end" loop executed? The program could also terminate because of an error, is there an error icon or message on the EV3 display?
Michael Verschaeve
CC BY-SA 3.0
2018-04-10T10:15:31.393Z
Also perhaps try renaming the outer loop. Perhaps "end" has a specific undocumented meaning...
Michael Verschaeve
CC BY-SA 3.0
2018-04-10T21:52:18.007Z
I'm guessing that the interrupts in loop 03 are somehow being triggered.
David Lechner
CC BY-SA 3.0
2018-04-11T04:26:16.183Z
@MichaelVerschaeve The sound at the very end does play, and there are no error messages. Changing the names of the loops does nothing different.
Dave Gillespie
<ev3><programming>
Loop interrupt stops all loops, not just the one designated
Dave Gillespie
# Loop interrupt stops all loops, not just the one designated

(Asked by: username_0 on 2018-04-10)

I have been using loop interrupts for a while, and not had an issue... until now. And it is driving me nuts.

My program has 2 main loops, titled "touch" and "end" with two more nested in the "touch" loop, both titled "01"- these are just for turning with the gyro. I've attached pics so you can see this in detail.

The problem loop is the "touch" loop - the main nested one. I have a separate thread running to check the state of a switch. When it is pressed, I have a loop interrupt for the "touch" loop only. Since it is nested, and I only have one loop interrupt, I would expect it to pick up with the "end" loop and start over... but instead it ends the program, as if I interrupted both "touch" and "end".

I'm obviously missing something here... anyone with ideas, please speak up.

[![Full program](https://i.sstatic.net/18Hu5.jpg)](https://i.sstatic.net/18Hu5.jpg)[![Start](https://i.sstatic.net/waoxK.jpg)](https://i.sstatic.net/waoxK.jpg)[![End](https://i.sstatic.net/bSonS.jpg)](https://i.sstatic.net/bSonS.jpg)

**Tags:** ev3, programming

> **Comments:**
> **username_1**: Is the code after the "end" loop executed? The program could also terminate because of an error, is there an error icon or message on the EV3 display?  
> **username_1**: Also perhaps try renaming the outer loop. Perhaps "end" has a specific undocumented meaning...  
> **username_2**: I'm guessing that the interrupts in loop 03 are somehow being triggered.  
> **username_0**: @MichaelVerschaeve The sound at the very end does play, and there are no error messages. Changing the names of the loops does nothing different.  

---

## 0 answers

