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