Рет қаралды 2,750
You can connect an ultrasonic HC-SR04 (or similar) module to your Arduino UNO with just two wires (plus power, of course) to get really accurate distance measurements.
Here we have some ultra-simple code to do this plus a mechanism to control the power to the ultrasonic module to save power when running on battery, for example.
Initially, we roll our own code to do this but a description of the de-facto industry standard ultrasonic library NewPing is also covered.
You can do this entire project in about 30 minutes, no kidding.
You can support me by buying me a coffee!
buymeacoffee.com/ralphbacon
Links to the code is posted below, just copy it to a folder of the same name and use the Arduino IDE to open it.
www.dropbox.com/sh/5nrniyjan5...
And my channel is here:
/ ralphbacon