Skip to content

Commit 5a13cb4

Browse files
authored
ultrasonic functions faster
Atrigger pulse of 10 milliseconds was used while only 10 microseconds was needed. So it was 1000 times longer then needed. Fixe.d
1 parent 703d766 commit 5a13cb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib_robot_maqueen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def goto(self,dir,spd,dst):
110110
def ultrasonic(self, maxDist=0.4):
111111
# pins: trig=2, echo=8
112112
mb.pin2.write_digital(1)
113-
time.sleep_ms(10)
113+
time.sleep_us(10)
114114
mb.pin2.write_digital(0)
115115
mb.pin8.read_digital()
116116
timeOut=int(maxDist*2*1000000/340.29)

0 commit comments

Comments
 (0)