prajesh828
New Member
Hi M new here m doing a project on alrtbot 2.1. Using picaxe 28x2.
I'm solving a maze with it. Now it almost clears the maze. But m not satisfied. Is there any program that you can write so the robot can clear any maze?
I have wrote the program for this particular maze.
Here is the program
pwmout pwmdiv4, C.1, 99, 320
pwmout pwmdiv4, C.2, 99, 315
symbol swL=pinc.4
symbol swR=pinc.7
symbol counter=b10
counter =0
main:
forward a: forward b
if swL=0 then
gosub check
gosub turnR
elseif swR=0 then
gosub check
gosub turnL
endif
goto main
`------------------------------------------------
check:
pause 200
if swL=0 and swR=0 then
gosub driveback
counter=counter+1
gosub turn `----side turn
endif
return
driveback:
backward a: backward b
pause 600 `----------
halt b : halt a
return
turn:
if counter <4 then
gosub L90
elseif counter <6 then
gosub R90
elseif counter =6 then
stop
endif
return
turnL:
forward a : backward b
pause 200
halt a : halt b
pause 100
return
turnR:
forward b : backward a
pause 200
halt b : halt a
pause 100
return
L90:
forward a : backward b
pause 1000
halt a : halt b
pause 200
return
R90:
forward b : backward a
pause 1000
halt b : halt a
pause 200
return
but if i my robot was put into another one it won;t solve that maze. So what can i do to make it solve any given maze? Use of infrared or sensors or cds?
I'm solving a maze with it. Now it almost clears the maze. But m not satisfied. Is there any program that you can write so the robot can clear any maze?
I have wrote the program for this particular maze.
Here is the program
pwmout pwmdiv4, C.1, 99, 320
pwmout pwmdiv4, C.2, 99, 315
symbol swL=pinc.4
symbol swR=pinc.7
symbol counter=b10
counter =0
main:
forward a: forward b
if swL=0 then
gosub check
gosub turnR
elseif swR=0 then
gosub check
gosub turnL
endif
goto main
`------------------------------------------------
check:
pause 200
if swL=0 and swR=0 then
gosub driveback
counter=counter+1
gosub turn `----side turn
endif
return
driveback:
backward a: backward b
pause 600 `----------
halt b : halt a
return
turn:
if counter <4 then
gosub L90
elseif counter <6 then
gosub R90
elseif counter =6 then
stop
endif
return
turnL:
forward a : backward b
pause 200
halt a : halt b
pause 100
return
turnR:
forward b : backward a
pause 200
halt b : halt a
pause 100
return
L90:
forward a : backward b
pause 1000
halt a : halt b
pause 200
return
R90:
forward b : backward a
pause 1000
halt b : halt a
pause 200
return
but if i my robot was put into another one it won;t solve that maze. So what can i do to make it solve any given maze? Use of infrared or sensors or cds?