Chapter 10. Wait for It!

One of the most useful things your robots will be doing is waiting. Yep, you heard me right—waiting. Don't believe me? Okay, think about it this way:

  • SPOT is moving toward a red line, waiting for the Color sensor to detect the line.

  • SPOT is preparing to throw a ball at a target, waiting for the Touch sensor to be pressed and released.

  • SPOT is rolling towards the wall, waiting for the Ultrasonic sensor to detect the wall.

  • SPOT is sitting on the start line, waiting for me to push the Left button to let it race forward.

Are you beginning to see that waiting is an important part of a robot's program? Your robots will probably always be waiting for something to happen. It may be as simple as waiting for you to press the Enter button ...

Get Lego Mindstorms NXT-G Programming Guide, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.