I used to work for Parallax and have a lot of experience with the Ping -- give this program a try, it seems to work correctly (please note that I'm new with Arduino, so I'm not as good with C as I am with PBASIC).
// Parallax Ping Demo
// -- Jon McPhalen
// -- www.jonmcphalen.com
// -- 27 DEC 2007
#define pingPin 8
void setup()
{
Serial.begin(9600);
delay(5);
Serial.println("Parallax Ping Demo");
}
void loop()
{
long distance = 0;
delay(500);
distance = getPing();
Serial.print("Raw distance is ");
Serial.println(distance, DEC);
}
long getPing()
{
long measure = 0;
digitalWrite(pingPin, LOW); // ensure output starts low
pinMode(pingPin, OUTPUT); // make it output
delayMicroseconds(1); // let it settle
digitalWrite(pingPin, HIGH); // ping!
delayMicroseconds(5);
digitalWrite(pingPin, LOW); // remove ping
delayMicroseconds(1);
pinMode(pingPin, INPUT); // configure to measure return
measure = pulseIn(pingPin, HIGH);
measure >>= 1; // reduce to one-way trip
return measure;
}