Ultrasonic Sensor Questions

I recently got my BrickPI about 3 weeks ago and it is fun to play with it!
I recently tested the Ultrasonic Sensor for it via Github examples for Python and I am wondering what does it really return?

When I enter the command to test it with, it spits out an integer of 255 out only, but when I placed my hand in front of it, it spits out integers that are lower than 255 and sometimes 255 too.

What does these numbers mean? Is it distance related or something?

If I plan to use the sensor to detect if something is in front of it, say a human or a piece of wood, would it detect it and spit out true/false?

I saw a video about the ultrasonic sensor used on the LEGO intelligent brick too and the person is able to change the distance in which it detects too, is that possible with the BrickPI?


Here is the video I saw about the last paragraph:

The number it spits out is the distance in CM to the nearest detected object. It’s pretty jittery, sonar’s not the most precise distance-measuring system going - you’ll basically want to do some testing to find out what figures you need, and also averaging the results and dumping those that are way out also helps.