How to interrupt from a infinite loop ??
kevinspace
Posts: 56
Hello everybody~
How to interrupt from a infinite loop(repeat) by push button??
And another question is how to switch between two infinite loops??
I tried to set a condition of interrupt in the repeat loop but it seems like didn't.
For example : I want to blink the LED always, and if it encounter a condition of interrupt, the blinking will be stop.
Another case is that I want to select any oneinfinite loops, how to write the code to switch it??
Are there any simple example??
Thanks a lot.
How to interrupt from a infinite loop(repeat) by push button??
And another question is how to switch between two infinite loops??
I tried to set a condition of interrupt in the repeat loop but it seems like didn't.
For example : I want to blink the LED always, and if it encounter a condition of interrupt, the blinking will be stop.
Another case is that I want to select any oneinfinite loops, how to write the code to switch it??
Are there any simple example??
Thanks a lot.
Comments
post your code or a more derialed description of what you want to do in the end
there are a lot of ways to do something like if condition stop blinking
for too infinite loops
code ONE loop and some if-conditions
if condtion 1 true
"do things1"
if condtion 2 true
"do things2"
really tell us what you want to do in the end
then good solutions can be found
for stopping a infinite loop see command quit PropManual page 186
best regards
Stefan
That said, as Stefan mentioned, you can write your loops so they'll stop when any of several conditions are met. There are also ways to use the ABORT statement and the "catch" operator ("\") in some circumstances for a subroutine to force a loop in its caller to exit to a higher call level.
Don't forget a Dira[LED]~~ also
- Ed
I have tried Dave's code and added the "dira[LED]~~" That to be successful.