7

How do you program mindstorms to keep doing a task until either the IR OR the colour sensor state changes. I would like to use the wait block but it can only be either the colour sensor or the IF sensor. i want to continue the activity until either sensor changes to a specified condition.

1 Answer 1

6

One way of doing this is using a loop and interrupting it.

sample code

How it works:

The "Loop Interrupt" block stops all blocks running inside of the loop, so by interrupting the loop after either wait block, it will stop the other wait block. The type of loop doesn't actually matter because we never reach that point. I chose to wait for "Logic" with a value of "False" just so that it is more clear that we are not actually looping here.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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