def distance(self):
"""Measure pulse length and return calculated distance [m]."""
self._pulse()
pulse_width_s = time_pulse_us(self._echo, Pin.high) / 1000000
dist_m = (pulse_width_s / 2) * self._sound_speed
return dist_m
评论列表
文章目录