Simple scanner for objects using ultrasonic distance sensor and servo motor.
Signal of distance's sensor is being converted to centimeters, and if no object is detected within 20 centimeters from the sensor, servo motor rotates it by adding 10 degrees to the total rotation. When servo reaches 180 degrees, then it starts turning backwise. Scanning is looped, while ultrasonic sensor does not detect any object within 20 cm from it.
Information passed through the serial communicator: If object is found, what distance it is from the sensor and what is the servo's angle. If no object is found, serial prints just the angle of the servo motor.
Comments