- :-

Topics Covered

  • Color Sensor
  • Forward Until Red
  • Lesson Links

    Check Your Understanding:
    1. 1. What does this program do when run?
    2. Move forward when the robot sees a red object
      Move forward until the robot sees a red object
      Move backward when the robot sees a red object
      Move faster when the robot sees a red object
    Mini Challenge

    Mini Challenge 1: Forward to Stop Line

    In addition to signs and lights, self-driving cars also need to obey pavement markings,
    like this stop line marking where to stop. Modify your Color Sensor attachment so that
    it faces downward, and program your robot to drive forward until it reaches the line.

    Configuration Requirements
    *ACTUAL DESIGN MAY VARY
    Virtual EV3 If using Robot Virtual Worlds, chose this configuration.
    Physical EV3 If using a Physical Robot, follow the BUILDING INSTRUCTIONS on page 47 in the Lego MINDSTORMS EV3 Education building manual. Instruction manual provided by Lego Education.

    The program is very similar to the "ForwardRed" program.

    Program the robot to move forward until it sees the line color

    + hint
    Try It!
    The EV3 Color Sensor can detect 7 different colors, plus the absence of color.
    Each of these 8 colors is labeled with a different number.
    Try it! 1

    Port View: Color Sensor Values

    You can see the Number value of the currently detected color directly on the EV3's viewscreen,
    in the Port View Mode.
    1. Use the Left and Right Buttons on the EV3 to navigate to the EV3 Apps menu (), and press the Enter Button to select 'Port View Mode'.
    The 8 blocks at the top and bottom of the screen represent the 8 ports on the EV3.

    - Motor Rotation Sensor values are displayed across the top.
    - Sensor Values are displayed across the bottom,
    depending on what is plugged in.

    2. Use the Left and right Buttons so that the Color Sensor's Port View block is selected.

    "COL-RELECT" means the sensor is reading amount of colored light being reflected.

    This is not what we want, since we want to see exactly what color the sensor is seeing, not the amount of color.

    3.Press the Enter Button on your EV3 while the Color Sensor's Port View block is selected.
    Move the Up and Down Buttons to select the type of reading 'COL-COLOR',
    and press the Enter Button to set new reading type.
    4.Now the Color Sensor's Port View will display the color value. ('COL-COLOR')
    1. 1. Point the Color Sensor directly at the Red side of the Color Crate.
      What value do you see?
    What happens?

    The number 5 appears, representing Red.

    1. 2. What value should you see if the Color Sensor is pointed
      at the Blue side of the Color Crate? Try it!
    What happens?

    The number 2 appears, representing Blue.

    1. 3. Point the Color Sensor away from the Color Crate and any strong lights.
      What reading does it give? Try it!
    What happens?

    The number 0 appears, representing No Color Detected..

    Did You Know?

    Did you know?

    How the Color Sensor Works