Testing the Light Sensor
Attach the single light sensor assembly to the front of
the robot as indicated in Figure 1. Hook it up to sensor
port 1. Now, we’ll do some tests.
• Power the NXT on and navigate to the “View” menu.
• Select “Reflected Light” > “Port 1.”
At this point, you’ll need a light surface with a dark line
(tape) or a dark surface with a light line. LEGO Education
sells several mats that are great for light sensor testing, one
of which can be found at http://bit.ly/legomat.
Stopping at a Line
Let’s try a simple program. We’ll make Eddie move
forward until he hits a black line. Figure 2 is a diagram of
the actions we want the robot to perform. Figure 3 is the
program. Note the programming logic:
• Motors C and B go backward (meaning the robot
goes forward) indefinitely.
• Wait for reflected light on port 1 under threshold
(if detecting black line) or over threshold (if detecting
• Stop motors C and B.
Time for something a little more exciting!
One of the most popular LEGO robotics competitions is
Sumo, where robots go head to head in an attempt to push
SERVO 10.2010 55