Obstacle Escaping Robot - Under $20!

#3
Thanks :) The chassis are "Elenco Twin Motor Gearbox for Hexapod Walking Robot". I got them at Amazon for $5.95 as add-in item a while ago. I used ear cleaners for 4 poles and the milkbottle for the robot's top and SRF005 handler, which is attached to the servo by paper clips. The only expensive part remaining is the tutorial board, which I am going to replace by AXE118 or similar.
 
Last edited:
#5
Nice robot. Will you share your code? I plan on building something like this this holiday season 12-15.
Thank you.
Sure, sorry for the delay...
Code:
 ;#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
 
Top