nickcinquino
New Member
Hi Picaxe Forum,
I'm messing with a simple robot, 14M2 controlled, two motors controlled by dual L9110 H-bridge board. On running the program, which is set up for parallel process, if the bump switch is engaged during highs of "search", outputs go nuts for unknown reason (it simulates perfectly). If the bump switch is hit during a pause in "search", it works fine. Any thoughts on whats wrong? Very likely crazy code on my part but I'll be darned if I can find a bug! Thanks for any help.
start0:
output c.4, b.5, c.2, c.1
input b.3 ;high c.4, c.2 fwd
symbol sw1 = pinb.3 ;high b.5, c.1 rev
if sw1 = 1 then search ;high c.4, c.2 turn L
low c.4, b.5, c.2, c.1 ;high b.5, c.1 turn R
#simtask all
goto start0
start1:
if pin3 = 1 then evadeR
goto start1
search:
for b0 = 1 to 2
high c.4
high c.2
pause 1500
low c.4
low c.2
pause 800
high b.5
high c.2
pause 800
low b.5
low c.2
pause 800
high c.4
high c.2
pause 1500
low c.4
low c.2
pause 800
high b.5
high c.2
pause 800
low b.5
low c.2
pause 200
next b0
goto start0
evadeR:
suspend 0
high b.5, c.1
pause 1000
low b.5, c.1
pause 300
high c.4, c.1
pause 1000
low c.4, c.1
pause 200
resume 0
goto start1
I'm messing with a simple robot, 14M2 controlled, two motors controlled by dual L9110 H-bridge board. On running the program, which is set up for parallel process, if the bump switch is engaged during highs of "search", outputs go nuts for unknown reason (it simulates perfectly). If the bump switch is hit during a pause in "search", it works fine. Any thoughts on whats wrong? Very likely crazy code on my part but I'll be darned if I can find a bug! Thanks for any help.
start0:
output c.4, b.5, c.2, c.1
input b.3 ;high c.4, c.2 fwd
symbol sw1 = pinb.3 ;high b.5, c.1 rev
if sw1 = 1 then search ;high c.4, c.2 turn L
low c.4, b.5, c.2, c.1 ;high b.5, c.1 turn R
#simtask all
goto start0
start1:
if pin3 = 1 then evadeR
goto start1
search:
for b0 = 1 to 2
high c.4
high c.2
pause 1500
low c.4
low c.2
pause 800
high b.5
high c.2
pause 800
low b.5
low c.2
pause 800
high c.4
high c.2
pause 1500
low c.4
low c.2
pause 800
high b.5
high c.2
pause 800
low b.5
low c.2
pause 200
next b0
goto start0
evadeR:
suspend 0
high b.5, c.1
pause 1000
low b.5, c.1
pause 300
high c.4, c.1
pause 1000
low c.4, c.1
pause 200
resume 0
goto start1