mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 21:19:35 +00:00
docs: fix sonar example
This commit is contained in:
@@ -73,8 +73,8 @@ def read_distance():
|
||||
global low
|
||||
done.clear()
|
||||
pi.gpio_trigger(TRIG, 50, 1)
|
||||
done.wait(timeout=5)
|
||||
return low / 58.0 / 100.0
|
||||
if done.wait(timeout=5):
|
||||
return low / 58.0 / 100.0
|
||||
|
||||
pi.set_mode(TRIG, pigpio.OUTPUT)
|
||||
pi.set_mode(ECHO, pigpio.INPUT)
|
||||
|
||||
@@ -73,8 +73,8 @@ def read_distance():
|
||||
global low
|
||||
done.clear()
|
||||
pi.gpio_trigger(TRIG, 50, 1)
|
||||
done.wait(timeout=5)
|
||||
return low / 58.0 / 100.0
|
||||
if done.wait(timeout=5):
|
||||
return low / 58.0 / 100.0
|
||||
|
||||
pi.set_mode(TRIG, pigpio.OUTPUT)
|
||||
pi.set_mode(ECHO, pigpio.INPUT)
|
||||
|
||||
Reference in New Issue
Block a user