Chapter 5. sensors

In this chapter, you’ll learn how to use the NXT sensors to get your robot to react to what is happening around it. In the example programs in the previous chapter, the robot didn’t react to anything around it; it simply followed the path you programmed. By using the NXT sensors in your program, you can make your robot avoid obstacles, follow a line on the floor, react to light or sound, and identify objects based on their color.

We learn about the world around us using our five senses (touch, sight, sound, smell, and taste). A robot uses sensors in the same way to gather information about its environment. The LEGO MINDSTORMS NXT kits come with several sensors, each of which is useful for solving certain problems, depending on ...

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.