Question 9: Robot eyes: Back to the book again. Add the ultrasonic sensor. The ultrasonic sensor measures distance in centimeters. Write a program that makes the car back up if something gets closer than 25 cm. Back up to a distance of 50 cm then stop.
|
Problem 9 uses the new ultrasonic sensor to run away from a predator. This sensor measures distance in centimeters. Start this program with a wait for distance less than 25 cm. Start the motors backwards and wait for distance greater than 50 cm, then stop the motors. Again loop if you like. |
|
|
|