Bats use sonar (echo location) to detect objects, now your robot can too
The BatBlock has a speaker and a microphone (they look the same).
The metal can on the right (with the T next to it) is the Transmitter (speaker).
The metal can on the left (with the R next to it) is the Reciever (mic).
The ultrasonic sensor sends out a very high frequency sound wave (that we can't hear). It then waits until that sound bounces off an object and returns to the sensor. Using a microphone it listens for the sound. It can then measure the time it took the sound to bounce off an object and return. Since we know sound travels about 345m/s the BrainBlock can calculate how far away the object is from the time it took.
When the sensor doesn't see an object it may return 0 or a large number (over 200).
You need to be careful to deal with both a large number and a zero in your program.