WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

Maxbotix EZ1 sonar

Maxbotix EZ1 sonar.
maxbotix ez1.jpg
The sonar can output data in a variety of different formats - but we use the analogue output and so it must be connected from the 'AN' output to an ADC pin and can be driven using the +5v regulated supply. The sonar can measure distances in the range 6 to 254 inches.
Example
Assuming you have called your sensor 'myDistance' in Project Designer then it can be accessed as follows:-
myDistance.read();
DISTANCE_TYPE cm = myDistance.getDistance();
cout << "Distance=" << cm;
Or dumped to the standard out destination using:-
cout << myDistance;
Function Summary

Valid XHTML 1.0 Transitional