Psst...come closer...
Before we move on to breaking this project into blocks, let's look at this new sensor that we are dealing with. As discussed earlier, a sensor is a device that gives an input to the Arduino, and tells it some kind of information about its surroundings.
An Ultrasonic Proximity Sensor, is a kind of sensor that gives the Arduino information about how close someone or something is to the sensor. It works by using very high frequency sound waves also called as ultrasonic waves, having frequency above 20,000 Hz. How this sensor can figure out the closeness of an object is similar to how bat's use their screeches to navigate while flying or hunting. You can visualize it by having a look at the following image:
Image source: https://in.pinterest.com/pin/572731277582697045/
A bat emits a sound wave which travels through air and then bounces off of an object. The reflected sound or echo is then picked up by the bat's large ears.
Depending on how long it took for the sound to reflect...