GitHub - mattwilliamson/Arduino-Sonar: Ultrasonic rangefinder library for arduino

1 min read Original article ↗

Arduino Sonar

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.

Circuit

Circuit

Action Shot

Action Shot

Installation

Copy the whole Sonar folder into to your Documents/Arduino/libraries folder.

There are more detailed directions in the Arduino docs

Usage

Using the library is dead simple:

#include <Ultrasound.h>
int pinSonar = 7;
Ultrasound sonar(pinSonar);
int distanceCentimeters = sonar.read();

Video

http://www.youtube.com/watch?v=tps1cN1xQcc