NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

robtillaart:
An echoPing can only be positive as any distance is positive .

That makes it ideal to use the negative values as error codes, but those should be in the primary ping function

True, but the logic is not with the ping echo, it's with the conversion to inches and cm. And this is where it can be zero as the sensor can read something closer than an inch, which yields a zero. Technically, it should never happen with cm. But, I'd rather go the safe route.

Making errors negative is basically what I'm doing, but with zero as the error value. Which is why the code is written that way, to accommodate the zero error indicator. Making the error a negative doesn't remove the need for that code.

Tim