Page 307 - Lego Mindstorms
P. 307
Robot 10 • RIS Turtle
}
penup();
}
In order to do this, we have written functions that monitor the rotations of
the drive motor by means of the light sensor. These functions translate the
driving and turning commands into the appropriate number of motor rotations
and then carry out the movements. Due to the nature of the robot’s design, it
must pause and shift gears prior to turning, which is also defined in the func-
tions. At the very beginning of the program, the robot undergoes an initializa-
tion sequence, which brings the gear shifter and penholder into the correct
positions. This is necessary because the robot does not know which position
these mechanisms are in when it is first turned on. We have included com-
ments throughout the program to explain the key points. Expert programmers
can feel free to use our ideas and completely rewrite the program, while begin-
ners should use it “as is” with the basic driving and turning commands.
NQC is a free program that has become very popular amongst LEGO
robotics enthusiasts. The best way to use NQC to program your robots is in
conjunction with the graphical interface called Bricx Command Center, or
BricxCC for short. This can be downloaded from http://members.aol.com/
johnbinder/bricxcc.htm. The NQC program for the RIS Turtle is available for
download on the Syngress Solutions Web site for the book
(www.syngress.com/solutions).
292292