Skip to content

Commit

Permalink
ultrasonic functions faster
Browse files Browse the repository at this point in the history
Atrigger pulse of 10 milliseconds was used while only 10 microseconds was needed. So it was 1000 times longer then needed. Fixe.d
  • Loading branch information
HuttNerd authored Jun 25, 2022
1 parent 703d766 commit 5a13cb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib_robot_maqueen.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def goto(self,dir,spd,dst):
def ultrasonic(self, maxDist=0.4):
# pins: trig=2, echo=8
mb.pin2.write_digital(1)
time.sleep_ms(10)
time.sleep_us(10)
mb.pin2.write_digital(0)
mb.pin8.read_digital()
timeOut=int(maxDist*2*1000000/340.29)
Expand Down

0 comments on commit 5a13cb4

Please sign in to comment.