Here's a basic, distance-sensing model for students and teachers, found on the "Matsu Blog" web site. (Click on the above picture for an enlarged view).
The model's pivoting, ultrasonic sensor is connected directly to a motor. The sensor pivots 180 degrees to search for the "open road", then heads in that direction.
See a video
See the basic program