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

michinyon:
Well that's a good point, but it is still likely to jump around between 10 and 11 cm.

Not if you turn off rounding. But, you are right, it can bounce between to different integers as well. However, that's because the sensor is not accurate to a fraction of a cm. It's not because the library doesn't do floating point. Basically, it's not helpful to do floating point math. But, feel free to do it. Replace "ping_cm()" with "ping()/57.0" and you'll get a decimal result. If you find this useful I'd really be amazed, but the library is designed so you can do it as shown.

Tim