Boe-bot > stop with sensors (need help for school)
LauwereysM
Posts: 1
Hey, I have a boe-bot and I use the boe-bot for a project on school, but I have a problem.
I wan't to have it like this > I make a program that he for example first ride straight and then ride to the left ...
But when something is in front of the sensors, the boe-bot needs to stop. I already make a program for the project and the sensors and they worked both, but they need to work together.
I don't know how to put those two projects together. So he is do the project (left, right, ...) and he stops when something is in front of it.
Here you see my project:
' {$STAMP BS2}
' {$PBASIC 2.5}
FREQOUT 5, 1000, 3000
pulsecount VAR Byte
PAUSE 2000
' Start from the base.
FOR pulsecount = 1 TO 141
PULSOUT 13, 850 + pulsecount
PULSOUT 12, 650 - pulsecount
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 500
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 1000
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 35
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 50
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 500
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 1000
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 50
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 120
PULSOUT 13, 850 + pulsecount
PULSOUT 12, 650 - pulsecount
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
FREQOUT 5, 200, 3000
PAUSE 50
FREQOUT 5, 200, 3000
END
This is for the sensors (I hope that this is good)
' {$STAMP BS2}
' {$PBASIC 2.5}
irdetectleft VAR Bit
irdetectright VAR Bit
pulseleft VAR Word
pulseright VAR Word
loopcount VAR Byte
pulsecount VAR Byte
DO
FREQOUT 8, 1, 38500
irdetectleft = IN9
FREQOUT 4, 1, 38500
irdetectright = IN3
ELSEIF (irdetectleft = 0) OR (irdetectright = 0) THEN
pulsecount = 0
pulseleft = 750
pulseright = 750
ENDIF
FOR loopcount = 1 TO pulsecount
PULSOUT 13,pulseleft
PULSOUT 12,pulseright
PAUSE 20
NEXT
LOOP
Ok, I need to combinate those two. The course of the boe-bot needs to stay.
THX
I wan't to have it like this > I make a program that he for example first ride straight and then ride to the left ...
But when something is in front of the sensors, the boe-bot needs to stop. I already make a program for the project and the sensors and they worked both, but they need to work together.
I don't know how to put those two projects together. So he is do the project (left, right, ...) and he stops when something is in front of it.
Here you see my project:
' {$STAMP BS2}
' {$PBASIC 2.5}
FREQOUT 5, 1000, 3000
pulsecount VAR Byte
PAUSE 2000
' Start from the base.
FOR pulsecount = 1 TO 141
PULSOUT 13, 850 + pulsecount
PULSOUT 12, 650 - pulsecount
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 500
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 1000
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 35
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 50
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 500
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 100
PULSOUT 14, 1000
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 50
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 120
PULSOUT 13, 850 + pulsecount
PULSOUT 12, 650 - pulsecount
PAUSE 20
NEXT
PAUSE 200
FOR pulsecount = 1 TO 40
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
FREQOUT 5, 200, 3000
PAUSE 50
FREQOUT 5, 200, 3000
END
This is for the sensors (I hope that this is good)
' {$STAMP BS2}
' {$PBASIC 2.5}
irdetectleft VAR Bit
irdetectright VAR Bit
pulseleft VAR Word
pulseright VAR Word
loopcount VAR Byte
pulsecount VAR Byte
DO
FREQOUT 8, 1, 38500
irdetectleft = IN9
FREQOUT 4, 1, 38500
irdetectright = IN3
ELSEIF (irdetectleft = 0) OR (irdetectright = 0) THEN
pulsecount = 0
pulseleft = 750
pulseright = 750
ENDIF
FOR loopcount = 1 TO pulsecount
PULSOUT 13,pulseleft
PULSOUT 12,pulseright
PAUSE 20
NEXT
LOOP
Ok, I need to combinate those two. The course of the boe-bot needs to stay.
THX
Comments