hc-sr04-ultrasonic-time

xod/common-hardware/hc-sr04-ultrasonic-time

Measures sound roundtrip time with HC-SR04 ultrasonic range meter. Keeps output intact if a ping fails (no echo or wrong connection).
hc-sr04-ultrasonic-time
@/hc-sr04-ultrasonic-time
Measures sound roundtrip time with HC-SR04 ultrasonic range meter. Keeps output intact if a ping fails (no echo or wrong connection).
TRIGport
Board port to which sensor’s `trig` pin is connected.
ECHOport
Board port to which sensor’s `echo` pin is connected.
PINGpulse
Triggers new ultrasonic ping which would result in the output update once sound echo will be captured. Pulses coming within 60 ms window after last one are ignored to fight sensor’s PCB resonance.
hc-sr04-ultrasonic-time
TsTsDONEDONEERRERRTRIGTRIGECHOECHOPINGPING
ERRpulse
Fires if ping failed
DONEpulse
Fires when ping is done
Tsnumber
Last measured sound roundtrip time in seconds.