Copy of std Ultrasonic range, but returns Max distance on failure so we can assume nothing close to us. My sensor seems to go low on ping capture, not success, so I changed timeout to max round trip to get full range.
Contains encoder KY040 patch, digital pullup input patch, example of usage. Encoder reads boolean inputs to obtain numerical value of revolution. Boolean outputs are used for clockwise and counterclockwise direction detection respectively.