Using a cheap HC-SR04 sonar unit with Arduino

…turns out to be ludicrously easy. Just wire it up – Vcc at 5V, ground, and the trigger and echo pins to a couple of the Arduino’s digital pins:

Arduino and HC-SR04 ultrasonic module

and some nice chap has written an OO library for it. The code to read it turns out to be just this:

Copyright © Found
Jim Finnis' personal blog

Built on Notes Blog Core
Powered by WordPress