Thank you all for your warm welcome and quick reply.
Having just turned 18 I would no way near consider myself as advance as any of you guys and girls, my program I am trying to work is below;
It works fine, just that it only works for one bumper side, which is left. I can get it to work for the right bumper (by replacing %00000010 with %00010000) but not both simultaneously, yes I am using the BOT120 PICAXE-20X2 and the setint command doesn't work for both, I have a massive book by David Lincoln on the PICAXE series and that doesn't shed too much light. Are there any other command I can use, could any of you suggest with what lines I would need to change or add below?
Once again, many thanks.
setint %00000010, %00000010 'Tells the PIC to constantly look at pinC.1 (Left Bumper)
input c.5 'Sets motor speed fast
start:
symbol MID_LEVEL = 246 ' Point between marked black line and white reflective path floor
symbol LIMIT = 10000 '5 cycles, change to 10000 for longer patrol path
b2 = 0 ' sets a value back to zero
main: ' main routine to get the microbot to follow a black line for a certain amount of time
for W6 = 1 to LIMIT 'loop command, will loop for 'limit' amount of times,
if pinC.1 = 1 or pinC.3 = 1 then
halt A
halt B
else
readadc 8, b1
if b1 < MID_LEVEL Then
forward A
halt B
else
halt A
forward B
end if
end if
next W6
halt A
halt B
scan: ' tekks another off-board PCB that it has stopped and is ready to scan the area
high B.0
pause 200
low B.0
idle:
if pinC.4 = 0 then idle ' will stop until the external PCB has finished scanning and tells to continue
goto main
interrupt: 'if pinC.1 is hit at any time program runs here to decide appropiate action
forward A ; go forwards
forward B
; test bumpers
; to see if hit
if pinC.3 = 1 then doLeft
if pinC.1 = 1 then doRight
doLeft:
backward A ; reverse for 0.1s
backward B
sound B.2,(50,10) ; beep
pause 200
forward A ; turn for 0.05s
backward B
pause 120
setint %00000010, %00000010 ' reset the interrupt command
return ' returns to main routine
doRight:
backward A ; reverse for 0.1s
backward B
sound B.2,(100,10) ; beep
pause 200
backward A ; turn for 0.05s
forward B
pause 120
setint %00000010, %00000010 ' reset the interrupt command
return ' returns to the main routine