the “steering” tab of a move block. More on that later.
String or text variables are rarely used with the NXT
since the only way to output text is on the small screen
which usually isn’t accessible when a robot is in motion.
String variables store text. For instance, a string variable
might be “Hello World!” They’re rarely used, and when they
are, it’s often for simple chat robots which interact with a user
through text. With all that in mind, let’s get to the robots!
Revisiting the Line Follower
Last month, we made Eddie follow a line using one light
sensor, and built an attachment to follow a line using two
light sensors. This time, we’ll put that attachment to work!
Let’s start by attaching it to the robot. For double light
sensor attachment building instructions, see the October
issue. Figure 1 shows Eddie with the double light sensor
assembly attached. Note that it is in the lower of the two
potential positions. This means the light sensor will be closer
to the ground, thus giving us more accurate readings. Plug
the left sensor into port 1, and the right sensor into port 2
(Figure 2). Now let’s talk programming logic.
Thinking Like a Robot
So, we’ve got Eddie set up with two light sensors. Now
we just need to understand what to do with them.
• If your floor is light in color, find some dark tape. If
it’s dark, find some light tape.
• Lay the tape out on the floor in a zig-zag pattern.
With two light sensors, we have several options for how we
can follow the line:
• We can put one light sensor on either side of the line,
and have Eddie turn into the line when one of the
sensors detects it.
In this article, we’ll be using the first of the listed
options for following a line. As you’ll see, even though
we’ve already narrowed down what we’re programming the
robot to do, there are many different ways to program the
robot to ultimately do the same thing!
• Set Eddie on top of the tape, and make sure that
the light sensors are far enough apart that when
Eddie is centered on the tape, one light sensor
38 SERVO 11.2010