Ultrasonic range finder

The third sensor that we will be using is a MaxSonar EZ1 Ultrasonic range finder. This sensor is one of my favorite sensors to use. I have used it in almost every autonomous robot that I have built to determine the distance to nearby objects. The following is an image of the EZ1 Ultrasonic range finder:

For the example, in this chapter, we will be using pins 3,6, and 7 on the sensor. Pin 3 is used for analog out, pin 6 is for VCC and pin 7 is for ground. Pins 4 and 5 are for serial RX/TX connection and pin 2 is for a pulse-width output, however, we will not be using those outputs in the example for this chapter.

An ...

Get Mastering Arduino 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.