This code uses the libgpiod library and time stamped events to measure the length of the echo pulse. See https://github.com/HankB/GPIOD_Debian_Raspberry_Pi/blob/main ...