Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

yasasri's Content

There have been 1 items by yasasri (Search limited from 27-April 23)


By content type

See this member's

Sort by                Order  

#52968 Library for HC_SR04 Ultrasonic Rangefinder

Posted by yasasri on 27 September 2013 - 05:09 PM in Netduino 2 (and Netduino 1)

Someone might find this code useful. I found these HC SR04 ultrasonic rangefinders on amazon for $15 but they had no code. I found some Arduino code, but was pretty useless for Netduino because it used blocking for the timing. So I wrote my own that uses interrupts for the timing. We used this successfully on a mobile robot for detecting obstacles. Accurate to sub-inch against hard surfaces. It is calibrated for my altitude and climate, you may need to adjust the InchConversionFactor and LatencyTicks for your environment. If you want it to read centimeters, just add your own TicksToCentimeters function. Enjoy and feel free to improve it. 2012/04/03 - Corrected pin documentation on constructor

 

 

Thank you sir for sharing this,

 

But your code seem to be not working when 4 sonar sensors are connected together, When I try it using 3 sonars it works fine, But for 4 sonar sensors I gives false value in a one sonar.  Does anyone have any idea why?





home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.