the BumperBot2 program

In the original version of the BumperBot program, a Move block with the Duration item set to 300 degrees was used to make the TriBot back up after it hit something (see Figure 5-43). But what if you want the robot to beep while backing up, like a school bus or large truck?

You already know how to use the Sound block to make the robot beep; the real challenge comes in making it beep while moving. One way to do this is to start the robot moving using a Move block with the Duration item set to Unlimited and then use a Loop block to stop the robot after it has moved 300 degrees. Inside the Loop block, you can use a Sound block to make the robot beep.

The following instructions replace the Move block circled in Figure 5-43 with ...

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.