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

Devantech/SRF02_Sonar.h

Devantech SRF02 sonar.
srf02.jpg
The sonar uses the I2C bus and also requires a +5v regulated supply. On the Axon this means using the power headers from an ADC pin. The sonar can measure distances from about 17cm to about 250 cm. The default I2C address is 0xE0 but can be changed to one of 16 values.
It may be defined using:
Devantech_SRF02 sensor = MAKE_Devantech_SRF02();
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