Follow a Line

Objective

Use the Switch Block to make dynamic sensor-based decisions.

 

Need more info?

View the User Guide.

Build It

Build the following modules using the building instructions available below or the printed booklet included in your brick set.

 

Driving Base

Color Sensor Down

 

Skip this step if the model is already built.

Animation

Play the video to the right to see how the program controls the robot.

Test It

Recreate the program shown, then download it and run a test.

 

Hint: If your robot does not follow the line, scroll down to adjust the sensor threshold.

 

Add a Comment Box to the Canvas (see the purple palette). Describe the robot's behavior in as much detail as possible.

Modify It

Now it’s your turn! Test whether or not your robot works when following a lighter-colored line. If not, try setting the threshold again.

Setting a Threshold

In the following steps, you will measure the light and dark light levels from the Color Sensor and use those values to find the average light level. This will become the threshold, which is the point at which the robot should start performing a different action.

First, move the Color Sensor over the dark line.

Next, look at the Port View and note down the value shown on Port 3. This is the minimum value (x). If no value is displayed, make sure you are connected to the EV3 Brick (see the Quick Start Video, which you can access from the Menu).

 

Hint:The Port View App on the EV3 Brick can also be used to view real-time sensor readings.

Now move the Color Sensor away from the dark line.

Note down the value shown on Port 3. This is the maximum value (y).

To set the threshold, calculate the equation (x+y)/2 and enter the result in the Switch Block’s Threshold Value parameter (your value may differ from the example shown).

Place the robot with the Sensor pointing away from the line and run the program to test.

The maximum quantity of an item that can purchased in each transaction is 99.

To inquire about purchasing more than 99 of one item, please call 800-362-4308.

To inquire about purchasing more than 99 of one item, please call 800-362-4738.