Chapter 8. Using the Ultrasonic Sensor

Introduction

Like the light sensor, the ultrasonic sensor is useful for detecting objects that are some distance away from the robot. However, unlike the touch sensor, the ultrasonic sensor does not rely on physical contact. The distance gives more space in which to respond. Generally, the ultrasonic sensor is used for distances of 10 centimeters or more, whereas the light sensor is used at shorter distances.

Programs that employ the light sensor can be adapted to use with the ultrasonic sensor. For instance, you can use the ultrasonic sensor to scan the room for nearby objects.

The ultrasonic sensor can be used for detecting and avoiding objects. Programs for wheeled buggies like QuickStart are easily ...

Get Programming Lego Mindstorms NXT 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.