Now, for the pièce de résistance, we have the obstacle-avoiding robot. We will start by describing the functionality we wish to achieve and then we will figure out how to achieve it.
The sequence of actions (functionality) we expect from the obstacle-avoiding robot is as follows:
- On activation, the robot starts to move forward in a straight line.
- The LEDs flash green.
- When an obstacle is encountered, the robot stops.
- The LEDs flash red.
- The Stop sound is played.
- The robot moves backward for 2 seconds.
- The LEDs flash orange.
- The robot makes a right-hand turn (90 degrees), turning in place.
- The LEDs continue to flash orange.
- Forward motion is resumed until the next obstacle is found. Essentially, the entire process ...