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.
If the results is less than 200cm, the LED connected to pin 5 will be turned on, otherwise it will be turned off.