Blog Home

HC-SR04 ultrasonic Arduino library

Davide GombaOctober 20th, 2011

This is nice. I hope Carl posted the library in the Census

Carl Nobile has developed and released an Arduino library covering the HC-SR04 ultrasonic sensor. He writes: “It features timing, metric conversion, and standard deviation methods, plus a few support methods. It is written in C++ to conserve the namespace. The conversion formula can be easily modified to optimize the accuracy of conversion at different distances for inches and centimeters. Multiple buffers of different lengths can be created for determining standard deviation.

Look at the code and examples to understand how the library works. The standerd deviation code can be removed from the compilation resulting in a significant savings of resources. To do this comment the #define COMPILE_STD_DEV definition in the header file.”

via [dangerousPrototypes] downlaod the library from [FreshMeat]