Robo_Maker
New Member
This is the basic obstacle escaping robot with 1 ultrasonic range finder mounted on servo:
[video]https://youtu.be/OzjB4EKYGWQ[/video]
[video]https://youtu.be/OzjB4EKYGWQ[/video]
Sure, sorry for the delay...Nice robot. Will you share your code? I plan on building something like this this holiday season 12-15.
Thank you.
;#terminal 9600
symbol right = W4
symbol left = W5
sound B.6,(180,30)
main:
high b.3
high b.2
high b.1
high b.0
;pause 300
gosub dis
debug w1
if w1 < 20 then
low b.0
low b.1
sound B.6,(180,30)
servo B.7, 200
pause 200
gosub dis
left = w1
servo B.7, 75
pause 200
gosub dis
right = w1
servo B.7, 130
pause 100
servo B.7, OFF
if left = 0 or right = 0 then
goto main
else
goto turn
end if
end if
goto main
turn:
debug left
debug right
if right < 10 and left < 10 then
goto uturn
else
if right > left then
low b.3
low b.2
low b.1
low b.0
high b.0
high b.3
wait 1
low b.0
low b.3
else
low b.3
low b.2
low b.0
low b.1
high b.2
high b.1
wait 1
low b.2
low b.1
end if
end if
goto main
uturn:
low b.1
low b.0
high b.1
wait 2
low b.1
goto main
dis:
pulsout c.0, 2
pulsin c.1, 1, w0
pause 20
w1 = w0
' check distance twice
pulsout c.0, 2
pulsin c.1, 1, w0
pause 20
w1 = w1 + w0
w1 = w1 * 5 / 116 ; 116/2 = 58 Convert to cm
return