Maxbotix EZ1 sonar.
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:-
The sensor can then be read using:-
and then the distance in cm will be in sensor.distance.cm