NXT Training Mission 4: Ultrasonic Vision

  1. Set the motors to move forward.

  2. Wait for the ultrasonic sensor to detect an object within 3 inches.

  3. Stop motors (coast).

  4. Experiment with various locations for you sensor so it works best for detecting a box versus detecting a domino.

  5. Save this program as m4ObjectAvoidance then download and test your program.

Challenge: Modify your program so when an object is detected Alpha Bot turns 90 degrees (a complete right turn), drives ~4 inches and turns left 90 degrees. Proceed forward if no object is present, backup this time when the object is detected. Save, download and test your program.

Place your code inside a loop forever block. Next, instead of always turning right, add a random variable and turn right if the value is 1, turn left if the value is 0. Save, download and test your program.

Write down your comments recording any problems and their solution or any pertinent details learned during execution of this mission. What other ways might Alpha Bot avoid obstacles?