the starting point

As a starting point for this discussion, I’ll use the LineFollower program from Chapter 6, as shown in Figure 18-1. This program allows the TriBot to follow a line, but it works only if the robot moves slowly.

The original LineFollower program

Figure 18-1. The original LineFollower program

Although the Light Sensor is used in Figure 18-1 and in the images in this chapter, the program will work just as well with the Color Sensor. As we proceed, I’ll give instructions for using either sensor.

To follow a line, the Light Sensor (or Color Sensor) should be mounted on the front of the TriBot pointing downward, as shown in Figure 18-2.

Figure 18-2. Mounting the sensor on ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.