The Bowmar Builders are an FLL team associated with Bowmar Elementary School. The purpose of this blog is to help other students interested in robotics to learn from what we have learned. As an FLL Robotics team we use the Lego EV3 robotics system and the Mindstorms graphical programming language.

Friday, August 19, 2016

Color Menu

By Mateo B.

This is an example program that demonstrates how to use a color sensor to select a set of commands.

There are several parts to this program. The first is a main loop. In this example it goes on infinitely.

The second part is the first switch block. It tells the color sensor in port 3 to look for the color red.

The true part means the color sensor in port 3 found the color red, so it should do the first code branch. In the example, this is to make a barking sound and pivot to the right.

The false part means the color sensors did not find red, so go on to the next check of the color sensor.

At the second check of the color sensor, it looks for the color yellow. If it finds the color yellow, then it starts the second code branch. If it does not find the color yellow, then it exits both of the switch statements with doing nothing. Because it is still in the main loop, it will keep repeating the process to search for the chosen colors.

If you wanted to add more choices, add more switch blocks and follow the pattern.


  if sensor3 equals red then:
    <Do code branch #1>
    if sensor3 equals yellow then:
      <Do code branch #2>
} while (true)