We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0813879 commit 68bf9eaCopy full SHA for 68bf9ea
pslab/external/hcsr04.py
@@ -108,7 +108,7 @@ def estimate_distance(
108
self._pwm.set_state(**{self._trig.lower(): 0})
109
(t,) = self._la.fetch_data()
110
self._sanity_check(len(t), 2 * average)
111
- high_times = t[::2] - t[1::2]
+ high_times = t[1::2] - t[::2]
112
return speed_of_sound * high_times.mean() / 2 * 1e-6
113
114
def _sanity_check(self, events: int, expected_events: int):
0 commit comments