
programming
and testing
bumper-bot
Although I said at the beginning of the chapter that Bumper-
Bot explores its surroundings, the robot cannot determine
its location or current direction. For Bumper-Bot, explora-
tion means driving forward and changing direction whenever
it hits an obstacle with its bumper. We’ll examine two NXT-G
programs that present variations on this approach.
exploring: the basic approach
Our first program, Bumper-Bot1 (Figure 12-3), begins by
waiting for you to press and release the bumper. When you
do, the NXT plays a tone and the main part of the program
gets under way. In a Loop block that repeats forever, there
are f