Help with roaming with ir modified program.
Hello,
I built a rover that has two motors controlled by transistors. I modified the program roamingwithir.bs2 from the Robotics with Boe- Bot book www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv2_2.pdf . I modified it so that rather then using the PULSOUT command to control the continuous rotation servos i just used the HIGH and pause commands to activate the motors. What i would like to do and need help with is figuring out how to modify the FastIrRoaming.bs2 (same book) to work with the two motors instead. The code of the FastIrRoaming.bs2 is posted below, please help me figure out how to modify it. Thanks
' Robotics with the Boe-Bot - FastIrRoaming.bs2
' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
irDetectLeft VAR Bit ' Variable Declarations
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
DO ' Main Routine
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
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
PULSOUT 13,pulseLeft ' Apply the pulse.
PULSOUT 12,pulseRight
PAUSE 15
LOOP ' Repeat main routine
I built a rover that has two motors controlled by transistors. I modified the program roamingwithir.bs2 from the Robotics with Boe- Bot book www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv2_2.pdf . I modified it so that rather then using the PULSOUT command to control the continuous rotation servos i just used the HIGH and pause commands to activate the motors. What i would like to do and need help with is figuring out how to modify the FastIrRoaming.bs2 (same book) to work with the two motors instead. The code of the FastIrRoaming.bs2 is posted below, please help me figure out how to modify it. Thanks
' Robotics with the Boe-Bot - FastIrRoaming.bs2
' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
irDetectLeft VAR Bit ' Variable Declarations
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
DO ' Main Routine
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
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
PULSOUT 13,pulseLeft ' Apply the pulse.
PULSOUT 12,pulseRight
PAUSE 15
LOOP ' Repeat main routine
Comments