:question I've tried using the example code and only get returns of 328cm. Then I tried simplifying it, trying to understand whats going on but with little success.
// Simplified Ping Code
const int pingPin = 7;
int duration;
void setup()
{
Serial.begin(9600);
}
void loop()
{
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH, 700);
Serial.println(duration);
delay(500);
}
In the Serial Monitor I get returns of ...
19088
19088
19089
19088
I've tried different pins and I'm using a book as a target with the Ping)) on the edge of a table.
HELP