The HC-SR04 ultrasonic sensor is a very affordable proximity/distance sensor that has been used mainly for object avoidance in various robotics projects. It essentially gives your Arduino eyes/spatial awareness and can prevent your robot crashing against a wall. It has also been used in turret applications, water level sensing, and even as a parking sensor.

Start up the Arduino software IDE (Integrated Development Environment) and open the Blink example sketch (reported below) that is available in the File>Examples>Analog menu of the Arduino/Genuino software. Sketches are written in Arduino C.

Advertising

Advertising

Advertising

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.