object avoidance bot
lobo
Posts: 100
in the code for fastIrRoaming with the boe-bot (page 266)
the bot is using a pair of obstacle ovoidance ir's
but what if i wanted to use 3 or 4, how would i modify the code here?
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
the bot is using a pair of obstacle ovoidance ir's
but what if i wanted to use 3 or 4, how would i modify the code here?
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
'add your new detector numbers here.
FREQOUT 3, 1, 38500 'maybe this
irDetectcenter = IN4 'maybe this
' Decide how to navigate.
IF (irDetectLeft = 0) AND (irDetectRight = 0) AND (irDetectcenter = 0)THEN
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectcenter = 0) THEN 'this would be if there is a small object in the center
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