Original bits by Logan Park, Ph.D., in honor of his astonishingly beautiful wife.

Pretty much everything else is... based on: http://www.maxbotix.com/documents/HRXL-MaxSonar-WR_Datasheet.pdf and on the Arduino Mega 2560 ADK: http://arduino.cc/en/Main/ArduinoBoardADK and on this handy ASCII chart: http://www.csgnetwork.com/asciiset.html and a bunch of posts on the Arduino forums.

1. Connect pin 5 (tty/serial) of the ranging unit to pin 19 (Serial1 RX) on the Mega 2560. 2. Connect pin 6 of the ranging unit to any 5V supply on the Mega 2560. 3. Connect pin 7 of the ranging unit to any GND on the Mega 2560. */

void loop() { if (Serial1.available() > 5) // Then at least one complete range, 6 characters long, is stored in the RX buffer. { int inByte = Serial1.read(); // Examine the first stored character and decide what to do.