SR04 is a module that can detect distance between 2cm to 400cm by sending out ultrasonic waves and calculating the time between the sent signal and echo received.
Steps:
Steps:
- Send the trigger signal - a TTL 10us signal
- Wait for the echo pin to get high.
- Calculate the time for which the echo pin is high using a timer.
- Calculate the distance using
Distance = high level time * velocity (340M/S) / 2


