Exercice : Mini Challenge
Mini Challenge 1: Color Sensor Compare Switch
The Switch can use sensors to make its decision as well.
Change the Switch's mode to Color Sensor > Compare > Color.
Put different parts of the color crate or colored cards or in front of the Color Sensor each time you run the program.
Question
For this mini-challenge, program the robot to turn to the right if it sees green or brown, and left if it sees any other color. The robot only needs to do this once per run, using the color it sees as soon as the program starts.
Mini Challenge 2: Color Name Reader
Some switches can have more than two branches.
Try creating a Switch with its Mode set to Color Sensor > Measure > Color.
Then, press the tiny + button (Add Case) on the Switch.
Instead of a checkmark or X symbol, each branch now has a color. When run, the Switch checks the Color Sensor, and runs the branch with the matching color.
If no match is found, the branch with the Default Case dot is run.
Question
For this mini-challenge, create a program that will say the name of the detected color out loud, by playing the Sound for that color word.