How to use an HC-SR04 Ultrasonic Distance Sensor with Arduino

The HC-SR04 is an inexpensive, easy to use distance sensor, with a range of 2 to 400cm. It is commonly used in obstacle avoiding robots and automation projects. Did you know that your car uses similar sensors in the parking assist system?