This is a simple library for the Arduino platform to read distance measurements from devices such as the Parallax Ping)) Ultrasonic Rangefinder. I bought a knockoff from Futurlec but it took about a month to get here from China through customs.
Copy the whole Sonar
folder into to your Documents/Arduino/libraries
folder.
There are more detailed directions in the Arduino docs
Using the library is dead simple:
#include <Ultrasound.h>
int pinSonar = 7;
Ultrasound sonar(pinSonar);
int distanceCentimeters = sonar.read();