
Classic Projects • Chapter 14 269
The second sensor is operated by the bumper. Having just one touch sensor
left, we decided to equip the vehicle with a single bumper, again one that is nor-
mally closed (Figure 14.22).
To program this robot, we suggest this simple sequence:
1. The robot goes straight, monitoring the bumper in a tight loop so it
stops as soon as it detects an obstacle. If you want effective braking, you
can also briefly reverse the main motor.
2. To avoid the obstacle, the robot maneuvers like real cars do. It turns the
steering left (or right) and goes back a bit, then turns right (or left) and
goes forward another short distance befor ...