Now, point the Ultrasonic sensor straight toward any object/obstacle (within 4 meters range) and the distance of the object will be displayed on the LCD screen. Slowly, move the entire device toward or away from the object/obstacle and observe how the distance displayed on the LCD screen changes.
Every time you move the device, wait for around 2 seconds in one position in order to get a stable reading on the LCD screen. Since the device will be handheld, the distance will keep changing due to mild movements of the human hand; therefore, to display a stable reading, the Arduino sketch has been written to run at every 2-second interval and display the calculated distance.