2

I have a "general-purpose" line-follower encapsulated in a MyBlock that runs an infinite loop.

Now, in a client program, I would like to interrupt that MyBlock if some condition is met; what the condition is should be determined by the client, so I don't want to put that logic into the MyBlock.

I also don't want to terminate the program altogether, and I want to keep the loop in the MyBlock.

Is there a way to break out of the MyBlock?

3

You can use the Loop Interrupt block. Just make sure the name used in the Loop Interrupt block matches the name of the loop inside of the My Block.

Loop Interrupt block

  • Make sure to make explicit calls to turn off the motors – banno Aug 16 '17 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.