the BumperBot program

Now that you know how the Touch Sensor works, let’s put it to use. In this section, you’ll build the BumperBot program, which uses the bumper on the front of the TriBot to help the robot wander around a room. When the robot runs into something, the Touch Sensor will be pressed. The program will react by making the TriBot back up, turn around, and then start again. The robot keeps going until you stop it by pressing the Exit button on the NXT.

When the BumperBot program runs, the robot should keep moving in a straight line until it runs into something. A Move block with the Duration item set to Unlimited will move the robot forward until its movement is stopped by another Move block. A Wait block using the Touch Sensor tells ...

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.