Click here to view video

The ultrasonic sensor sends out waves at a frequency that we can’t hear and measure the rate that they are bounced back. This number is then put through an if statement in the code that if it meets the condition allows the servo to move back and forth. Then it continues to take measurements and repeat the code.