programming help please

Maybe you should try your distance sensor before installing it on your robot. I suppose you got most of the code from an example for the distance sensor, didn't you?

Yes and sort-of.
This is the distance sensor i am using: