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

Devantech SRF02 sonar

Devantech SRF02 sonar.
The sonar uses the I2C bus and also requires a +5v regulated supply. 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 if you know what you are doing!
Assuming you have called your sensor 'myDistance' in Project Designer then it can be accessed as follows:-
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