EdVenture 7 – Watch out! There’s an obstacle!
Let’s do some autonomous driving
Edison is equipped with an obstacle detector, so he can see obstacles in his path and avoid them. Here’s a simple program that does this.

How the program works
Before entering an endless loop, the program turns on Edison’s obstacle detection system. Edison now emits infrared (IR) light from two light emitting diodes (LEDs), one on the left and one on the right. In between the two LEDs is an IR sensor. The sensor detects when IR is reflected from an obstacle. If the IR is reflected from the left LED then the obstacle is on the left. If the IR is reflected from the right LED, then the obstacle is on the right.
The IF icon asks; ‘have any obstacles been detected’? If the answer is no, then the cross path is taken and Edison drives forward. If the answer is yes, then the tick path is taken and Edison spins left for 0.1 of a second (100 milliseconds). See next page for calibration.
Experiment
Try detecting for obstacles on the left and right. See if you can add more IF icons and have Edison spin left to avoid obstacles on the right and spin right to avoid obstacles on the left.
EdFact
I’m sure you’ve heard of, or even seen, robot vacuum cleaners; well they use the same IR system as Edison to detect obstacles. The ‘Roomba’ has two of these sensors. One is used just like Edison to detect obstacles, and the other is used as a ‘cliff detector’ and looks at the ground in front of the robot to ensure it isn’t about to dive down a staircase.