Boe-Bot Maze Navagation
zBuster
Posts: 7
does anyone have a simple sample program for the BS2 Boe-Bot that allows it to travel through a maze and remember which way it traveled so that it can just go the shortest path after it did the maze once?
I currently have:
irDetectLeft VAR Bit
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 650
ELSE
pulseLeft = 850
pulseRight = 650
ENDIF
IF (IN15 = 1) THEN
LOW 14
ELSE
HIGH 14
ENDIF
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
LOOP
How would this be changes to incorporate the maze ability....
I only ask here cuz I cannot find a sample program anywhere.....lol
I really wana learn this an usually I gotta see one correct example to make my own setup later....
Thankz,
zBuster
I currently have:
irDetectLeft VAR Bit
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 650
ELSE
pulseLeft = 850
pulseRight = 650
ENDIF
IF (IN15 = 1) THEN
LOW 14
ELSE
HIGH 14
ENDIF
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
LOOP
How would this be changes to incorporate the maze ability....
I only ask here cuz I cannot find a sample program anywhere.....lol
I really wana learn this an usually I gotta see one correct example to make my own setup later....
Thankz,
zBuster
Comments
Also, if you are fairly new to programming and don't know many commands for pbasic, try reading the syntax guide and all the different commands. Scan through the ones you haven't heard about and read what they do. Then think about how it might be used to accomplish your task. It may take some more time, but in the end it will make you a better programmer.
Good luck!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PG