I am using an EV3 robot.

Is there a way to program it using a switch, or another way, to compare multiple colors?

The goal is to have the robot act as a car and use the color sensor to recognize red to stop, yellow to slow down and green to go in any given order.


1 Answer 1


Yes, a switch statement is present in EV3-G. Such statement would look like this: enter image description here

However, the only colors you can switch against are black, blue, green, yellow, red, white and brown (the basic lego colors). So unfortunately no orange.

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.