Consolidated PING)))/LaserPING Object for the P2 (Pulse or Serial)

With the addition of serial output to the Rev E version of the classic PING))) sensor, I wrote a consolidated object for the P2 that works in either mode, and doesn't require a cog for serial input. The code uses smart pin modes to measure pulses or receive the serial stream -- no cog is required by this object
Helpful methods in the object:
- get_us() (distance in microseconds, pulse mode only)
- get_mm()
- get_cm()
- get_tenths() (0.1-inch units)
- get_inches()
- in_range()
Yes, this object can be used with PING))) Rev D and earlier; one must specify pulse mode.
I posted the demo and object in ObEx: https://obex.parallax.com/obex/ping-for-ping-and-laserping-2/
The object has been tested and works in Propeller Tool, Spin Tools IDE, and FlexProp. There is a COMPILER constant to deal with the terminals for each environment.
P1 version here: https://forums.parallax.com/discussion/176232/
Comments
That sounds great!