In this short video, I show you how to set up an Arduino distance sensor that makes use of the HC-SR04.
Tutorial: [ Ссылка ]
Ultimate Books of Pi: [ Ссылка ]
This tutorial is pretty straight forward as the HC-SR04 is a pretty straight forward sensor to use. It's perfect for beginners that are just starting with electronics.
HC-SR04 is a very popular sensor and makes use of ultrasonic waves to work out how far an object is. It can detect distances from 2cm right up to 400cm.
The technical background around this sensor is a little more complicated. If you want more information, you will need to head over to our website.
The code for using this sensor is pretty straightforward. The easiest way to get this code is to copy it from our tutorial. Alternatively, you should be able to copy it from the video.
You will find that the trickest part of the code is understanding the math for working out the distance. I do my best at explaining it.
I hope that this video shows you everything you need to know about setting up an Arduino distance sensor. If you have any feedback, tips or anything else, then please don't hesitate to leave a comment below or over at pimylifeup.com
![](https://i.ytimg.com/vi/2u_8PHxG1qs/maxresdefault.jpg)