Open
Description
The ultrasonic sensor always has a distance. In the robot environment, if an object is not detected it sets the distance to be the maximum distance.
However, if the echo is not detected back the echo pin wouldn't change and then something like
duration = pulseIn(echoPin, HIGH);
would time out.