Servo & Ultrasonic sensor

Your problem is most likely related to how you are talking to the ulstrasonic sensor. Look at the NewPing thread in the sensor subforum, I would suggest using that library to talk to the sensor.