- :-

Topics Covered

  • Switches
  • Lesson Links

    Check Your Understanding:
    1. 1.The robot will move forward...
    2. ...if there is no object in front of the Ultrasonic Sensor when the program starts
      ...if there is an object in front of the Ultrasonic Sensor when the program starts
      ...if an object passes in front of the Ultrasonic Sensor at any time
      ...until an object passes in front of the Ultrasonic Sensor
    3. The robot makes its decision about whether to move forward or turn...
    4. Once, when the Switch is reached in the program
      Once, when the Switch sees an object
      Continually while the program is running
      The robot always moves, no matter what
    Mini Challenge

    Mini Challenge 1: Color Sensor Compare Switch

    The Switch can use sensors to make its decision as well.

    • Attach a Color Sensor to the EV3.
    ULTRASONIC AND COLOR SENSOR ATTACHMENTS

    Where can I find the instructions?
    • 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.

    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

    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.

    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.