Forward Until Near Stop when near a wall
NXT Ultrasonic Sensors
NXT Ultrasonic Sensors How does the Ultrasonic Sensor detect distance? The ultrasonic Sensor sends out a high-frequency sound pulse and times how long it takes for the echo of the sound to be reflected back. Since the speed of sound is known, the sensor uses rate and time to calculate the distance.
Forward Until Near Program
Motor Block One Details
Ultrasonic Block Two Details
Motor Block Three Details
Test Your Robot Stop when near a wall
Backward Until Far Back away from the wall until a specified distance is achieved
Backward until Far Ultrasonic Block Two Details Wait for the Ultrasonic Sensor on Port 4 to get a Far reading Far = Ultrasonic Sensor value > Threshold value
Test Your Robot Back away from the wall until a specified distance is achieved