servo, ping sensor issues with arduino

hmm .. actually there are objects at a distance of 1 to 3 feet on all 3 angles [0, 90, 180].

If I do not rotate the servo, the ping sensor is taking the readings every 2 seconds. [If I rotate it using the hand .. it was finely taking the readings as expected] :frowning:

Ping sensor is connected to port 7 and Servo is connected to port 9.

Please let me know if you need more information. Greatly appreciate your help.

Probably this might be a very common thing to do in robotics. to mount a sensor onto a servo and rotate it using the servo. Wondering if anybody have a sample code to achieve this and would like to share it? Thanks a lot !!