a simple guide to obstacle avoidance for your NXT
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Base Specifications
any base will work as long as it has a left-right motor configuration and can accept at least the ultrasonic sensor, so feel free to play around with that. this one uses parts from 2 expensive Lego sets so i wouldn't try too hard to replicate it.
Step 2: Programing
its actually very simple but here's how it works in simplified form:
() = loop,  = condition
wait [ultrasonic, closer than 20 in]
move back right
wait [ultrasonic, farther than 30 in]
you might have to play around with the distances there depending on available space and your robots size but other than that your good.
if you want a bit of a challenge, (its not that hard but its still kinda tricky if your a beginner) you may have noticed the touch sensors on my robot, that way if i run into a wall instead of moving the right motor back it moves the left one, if both sensors are touched it moves forward a few inches and turns back right again. good luck!
Step 3: R/C!
if you have Bluetooth and 2.0 software you have probably used the RC tool, but it has its limits i suggest the use of this one:
its free and works great