Detecting Obstacles with Edison

Script adapted from [1 p. 159-160].

Challenge

Program Edison to drive until it detects an obstacle

If Edison detects an obstacle, program it so that it will back up, turn away from the obstacle and then start driving again until it detects another obstacle.

  • turn obstacle detection beam on
  • loop forever
    • drive forwards if obstacle detected anywhere 
    • drive backwards 
    • Turn

 

    Challenge question and sample answer from [1 p. 113].