Project+106

Project #106 - Maze Traversal with Sonar Sensor

In this project you will use the light sensor and the sonar sensor. The objective is to navigate through the maze using the sonar sensor and stop when the light sensor detects the finish line (a black strip of electrical tape). First declare two integer variables: L (for left distance) and R (for right distance). Your robot will proceed straight until you come close to a wall (in most cases, 15 cm. is a good starting place). Then you will turn left and read the distance to the left wall into L, return to the point prior to the turn, and then turn right and read the distance to the right wall into R. Now your robot will turn left if that is the longer corridor or right if the distance is longer than the left.

 Hints: Read the sonar sensor and have it displayed on the screen using the "nxtDisplayCenteredBigTextLine(3,"%d",X); where X will be either the Right (R) or Left(L) variable. During the turning, you may want to implement a wait time of 2 to 3 seconds so you will have time to read the screen. After you robot has read the L and R distances, you will want to use a conditional statement similar to the following: if (R > L) TurnRight;.

 This is another very difficult challenge, it will require your robot to make a lot of decisions in order to navigate the maze correctly. Good Luck :)

 Resources: The Light Sensor and The Sonic Sojourn

 AE 5.4 and 5.5

media type="custom" key="8207882"

media type="custom" key="8087976" Who said that robots can't think?