This'll be the first library I've written for the Arduino. The guy(s) over at YeRobot had produced some code to interface with the sensor but it requires the hardware serial ports (0,1) which I wanted to avoid.
This library is intended to make life a little easier by encapsulating the measurement and serial functionality. Everything is handled for you with minimal delays so you can avoid blocking.
First up, we've made a slight modification to the NewSoftwareSerial library to include "new/delete" operators. I wasn't aware that the AVR C++ libraries excluded support of the implicit "new" operator, which also meant the library wouldn't be stand-alone.
To minimise the number of ports used vs. the original code, only RX/TX are used. The rest are just wired to VCC. You'll have to modify your setup accordingly.
It's really simple to use. begin(rxPort, txPort, baudRate) that'll setup the serial port to communicate with the device, any standard digital port is fine.
requestMeaurement() - Send the distance request command. It'll only ever allow you to request it once until a message has been received regardless of the times you call the method.
hasReading() avoids blocking, it checks until the serial buffer has sufficient data.
...and finally, getDistance(). This returns an integer.
Onto the code: http://svn.atl.mnetcs.com/repos/arduino/
Put that in a folder called URM37 within hardware/libraries.
I haven't added this to the playground yet as, well, I'm not sure if its stable or "arduino-like". Plenty of work left to do ;)
Does anyone have any comments or suggestions? It's all pretty buggy at the moment and generally needs polishing up :)