Microsoft MakeCode

Detect colors

Hi! A student is trying to get (base model) EV3 to do the following: On a white floor, go forward until blue color is detected, then raise bar (with small motor) and turn 90 degrees, then continue worward until red color is detected, then lower the bar, turn again and move forrward until black color is detected and then stop.
He’s tried all kinds of ways like On color X detected, and Forever - if color sensor color=blue
And Forever - While true, but it just seems to get confused. It can start turning on white and so on. How would you solve his problem dor best/easiest solution?

You probably want to use a “pause until color detected block” instead of the events. Here is how your solution could look like: https://makecode.com/_Jgx7C75ai0xp

Added functions and comments so that we can follow the code on the screen.

Great, thanks a lot, this is very helpful, will try suggested solutions to this and the color sorter as soon as possible!

Tried the color mission now, and it does what it should, except lowering the arm, on red, but I’ll try some more later! Thanks again!