RC2019 – UltraSonic distance-sensor example

Explanation: The code make use of the function getDistance() to translate the signal from the ultrasonic distance-sensor (connected to pin 2 and 4) into centimeters, the result is then returned by the function and stored in the variable distance. The value stored in the variable in then printed in the serial monitor.