problems with robot using ultrasonic sensor to avoid obstacles [solved]

My robot has a servo attached to the ultrasonic sensor, but only moves left or right when it "see" something, in your case if the servo moving left and right constantly i guess it will "see" obstacles on a wider angle