9.1. What is the Color Sensor?
What are they? Sensors that detect the intensity of light that enters it
Three modes: Color, Reflected Light Intensity and Ambient Light Intensity
Color Mode: Recognizes 7 colors (black, brown, blue, green, yellow, red, white) and No Color
Reflected Light: Measures the intensity of the light reflected back from a lamp that emits a red light. (0=very dark and 100=very light)
Ambient Light: Measures the strength of the light that enters the sensor from the environment. (0=very dark and 100=very light)
Move until a line, Follow a line, Find a color
Play a game using the color sensor
9.2. ANOTHER MOVE STEERING TIP: COAST or Brake?
Something more about the Move Steering Block
You will notice you have an option to COAST or BRAKE
Coast will make the motors keep moving. Brake makes the motors stop immediately.
Which do you use to stop EXACTLY on a colored line?
Make the robot move up to a green line using the color sensor?
Step 1: Use Wait For Color
Step 2: Use the color sensor in COLOR MODE
Step 3: Coast or Brake?
Hint: You will use Move Steering (think about motor on and off) and Wait for “Color”
Challenge 2 : Follow the black line.
Because the line has thickness, we can program the robot to follow the line in such a way that:
when the sensor “sees” white, the robot makes a point turn (a turn with a stopped wheel) towards black,
and when it “sees” black it does the opposite turn.
This algorithm is called a “two-step simple line follower” because it only has two actions. In addition, it demonstrates how the combination of small local movements, apparently nonsense (turns to the right or to the left), imply a global movement with a very special sense, in this case following the line.
Hints: When using the Color sensor with the “Measure – Color” mode to measure the color, it is important to select the Switch default case, for example, the white color. We can also select “No Color” as default in such a way that any detected color by the Color sensor not being black will execute this case. How will the robot behave if we do not configure the “No Color” case as default? Well, since you need to select a default case, the only other option will be to select the black color case, thus the program will always execute this branch, even while detecting white, because any detected color is different from “No Color”!