Servo motor with a ultrasonic sensor

Use the map function to convert distance to an angle, a servo position. Check Arduino/reference for mapping.

1 Like