I believe with sonar, you output a signal and then you wait to input it. Once you get it, you get a time value. You will then need to calibrate the sensor by collecting many value points and creating an equation the numbers recieved will flow through. Well, that's what I did with IR, and I believe the same with sonar. You will need to debug this way.
I am going to do some research with sonar today and I'll get back to you. To give you an idea what you have to do.
Make a program that all it does is pulse out then wait for something back. You can insert a break so you can continue this, and do it once at a time. Then, set an object x amount of inches/centimeters in front of it and get the data that comes back, record it, and I hope you know how to create a graph/equation using it.
After this, you just need to insert the equation into a program. Then have it tell the sensor to output and get input, run it through the equation, and you have the measurement of whatever is in front of it in a unit.
Try reading the data sheet for the Ultrasonic sensor. I'll get back