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

Maxbotix/EZ1.h

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. It may be defined using:
Maxbotix_EZ1 sensor = MAKE_Maxbotix_EZ1(ADC0);
The sensor should be initialised in appInitHardware using:-
distanceInit(sensor);
The sensor can then be read using:-
distanceRead(sensor);
and then the distance in cm will be in sensor.distance.cm

Valid XHTML 1.0 Transitional