Parallax Ping Sensor not giving accurate measurement

Hi I have an parallax ping sensor which is giving accurate measurements 2% of the time and inaccurate measurements 98% of the time. Im using an arduino uno. How can i fix this.

Start by posting code of your sketch and schematics of your setup so members can see what you’re up to, and also say what you’ve tried so far.

if u open up the 1.0.5 windows zip folder in examples you will find sensor inside the sensor folder you will find ping thats the code. Im connect the parallax ping sensor with 22 awg stranded wire to digital pin 7 of the uno 5v and GND. Im trying to make an obstacle avoiding robot that can move out of the way if there is an object in front of it.

Any help?

Going by your other thread, where you said that plugging the sensor in causes a problem on the board, I wonder if the sensor isn't faulty? In that other thread you say jiggling the wires sometimes gives accurate measurements?

I'd be inclined to try a different Ping sensor.....