mounting required a parameter of 80 to be
pointed directly forward.
An IF statement in Figure 4 allows the main
functions to be executed only if the reset button
on the S3 is pressed. This allows the user to start
the program by pressing this button.
The four user-defined functions shown then
make the robot perform the following tasks:
• Follow the line until the path is blocked by
• Prepare to circumnavigate the object by
following its contour.
• Hug the object’s contour until the line is
• Prepare to follow the line by aligning with it.
• Follow the line again until the path is
blocked by an obstacle.
Let’s look at each of these modules
individually to see how they work. Figure 5 shows
the FollowLine TillBlocked module. It begins by
moving the turret to its forward position.
Next, a loop continues as long as an obstacle
is not detected by the IR sensors. Inside the loop,
an IF statement gently turns the robot right or left
depending on the state of the line sensors.
You can control how fast the robot turns by
experimenting with the speed parameters
Figure 6 shows how the robot orients itself to
prepare for the wall following behavior. The IR
38 SERVO 02.2018