Roaming with Infrared Flashlights
With your IR object sensors built and tested, you are ready to make your ActivityBot roam and avoid obstacles without bumping into them.
IR Roaming Example Code
The IR Roaming code example makes the ActivityBot go forward until it detects an obstacle. If it sees an obstacle on the left, it will turn right. Likewise, if it sees one on the right, it will turn left. And if it sees obstacles on both left and right, it will back up.