Shop OBEX P1 Docs P2 Docs Learn Events
need help with "roaming with IR pairs" program — Parallax Forums

need help with "roaming with IR pairs" program

BenOBenO Posts: 5
edited 2006-02-22 01:15 in BASIC Stamp
this is the program and there is an error with the "Back_Up" command.·help ·'
[noparse][[/noparse] Title ]
' Robotics with the Boe-Bot - RoamingWithIr.bs2
' Adapt RoamingWithWhiskers.bs2 for use with IR pairs
' {$STAMP BS2}······························ ' Stamp directive.
' {$PBASIC 2.5}····························· ' PBASIC directive.
DEBUG "Program Running!"
'
[noparse][[/noparse] Variables ]
· irDetectLeft· VAR···· Bit
· irDetectRight VAR···· Bit
· pusleCount··· VAR···· Byte
'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000······················· ' Signal program start/reset
'
[noparse][[/noparse] Main Routine ]
DO
· FREQOUT 8, 1, 38500······················· ' Store IR detection values in
· irDetectLeft = IN9························ ' bit variables
· FREQOUT 2, 1, 38500
· irDetectRight = IN0
· IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
··· GOSUB Back_Up··························· ' Both IR pairs detect obstacle
··· GOSUB Turn_Left························· ' Back up and U-turn (left twice)
··· GOSUB Turn_Left
· ELSEIF· (irDetectLeft = 0) THEN··········· ' Left IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn right
··· GOSUB Turn_Right
· ELSEIF (irDetectRight = 0) THEN··········· ' Right IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn left
··· GOSUB Turn_Left
· ELSE······································ ' Both IR pairs 1, no detects
··· GOSUB Forward_Pulse····················· ' Apply a forward pulse
· ENDIF····································· ' and check again
LOOPis is the program and there is an error with the "Back_Up" command.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-22 00:23
    BenO -

    The "Back_Up command" (actually it's a subroutine) isn't even shown in the listing you offered, so it will be a bit difficult to offer any assistance at all.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-22 01:15
    This is why I always ask forum members to attach their programs instead of trying to paste them into the message.· All the formatting is lost as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.