…turns out to be ludicrously easy. Just wire it up – Vcc at 5V, ground, and the trigger and echo pins to a couple of the Arduino’s digital pins:
and some nice chap has written an OO library for it. The code to read it turns out to be just this:
#include <Ultrasonic.h>
Ultrasonic *s;
#define TRIG 10
#define ECHO 11
void setup(){
Serial.begin(9600);
s = new Ultrasonic(TRIG,ECHO);
}
void loop(){
long timing = s->timing();
float distance = s->convert(timing,Ultrasonic::CM);
Serial.println(distance);
delay(1000);
}

