I need your help in checking my code.Urgent please.

wvmarle:
Add a timeout to pulseIn, a few milliseconds is probably enough - just see how long it takes for the round trip of a soundwave at a bit more than the maximum distance you will ever have to measure. That'll make your robot much more responsive, instead of waiting for 1 second(!) before the function times out if there's no echo coming back to the sensor.

Good idea, but please specify I just need to add a "delay"?