Hi there. Earlier I had a problem with negative values showing up on my HC-SRO4. That's been fixed but now I have a bunch of zero's which keep triggering a response that is supposed to happen when the sensor detects it is within 20 cm of an object. the zeros appear to be happening within the 30cm range. Any ideas? Here's the part that controls the sensor in void loop:
int duration, distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH, 32760);
distance=(duration/2) / 29.1;
if I'm missing anything here, let me know and I'll get that up. Thanks