Shop OBEX P1 Docs P2 Docs Learn Events
Sumoboebot.bs2 from Robotics with he Boebot — Parallax Forums

Sumoboebot.bs2 from Robotics with he Boebot

lockadoclockadoc Posts: 115
edited 2006-03-29 07:27 in Robotics
HELP, i've run into trouble with this program.
I copied it from the book and can not get it to download to the bot. Keep comong up with errors. I can not find out where they are , can some one tell me what i'm typing wrong?
· Billy

Here it is as I typed it:

' ROBOTICS WITH THE BOE-BOT - SUMOBOEBOT.BS2
' SEARCH FOR OBJECT, LOCK ONTO IT AND PUSH IT
' {$STAMP BS2}
' {PBASIC 2.5}
IRDETECTLEFT··· VAR··· Bit············ ' LEFT IR READING
IRDETECTRIGHT·· VAR··· Bit············ ' RIGHT IR READING
PULSELEFT······ VAR··· Word··········· ' PULSE VALUES FOR SERVOS
PULSERIGHT····· VAR··· Word
'
{ INITIALIZATION }
·DEBUG "PROGRAM RUNNING!"
·FREQOUT 4, 2000, 3000····· ' SIGNAL START/RESET.
·'
{MAIN ROUTINE }
·MAIN:
·' SPIN AROUND SLOWLY UNTIL AN OBJECT IS SPOTTED
·DO
·· PULSOUT 13, 790······ ' ROTATE SLOWLY
·· PULSOUT 12, 790
·· PAUSE 15············· ' 5 MS FOR DETECTORS
·· GOSUB CHECK_IRS······ 'WHILE LOOKING FOR OBJECT
·LOOP UNTIL (IRDETECTLEFT = 0) OR (IRDETECTRIGHT = 0)
·' NOW FIGURE OUT EXACTLY WHERE THE OBJECT IS AND GO TOWARD IT
·DO
·' OBJECT IN BOTH DETECTORS -- GO FORWARD
·IF (IRDETECTLEFT = 0) AND (IRDETECTRIGHT = 0) THEN
·PULSELEFT = 850······· 'FORWARD
·PULSERIGHT = 650
·' OBJECT ON LEFT - GO LEFT
·ELSEIF (IRDETECTLEFT = 0) THEN
·PULSELEFT = 650······ 'LEFT TOWARD OBJECT
·PULSERIGHT = 650
·'OBJECT ON RIGHT - GO RIGHT
·ELSEIF (IRDETECTRIGHT = 0)THEN
·PULSELEFT = 850···· ' RIGHT TOWARD OBJECT
·PULSERIGHT = 850
·' NO OBJECT -- GO FORWARD ANYWAY, BECAUSE THE DETECTORS WILL
·ELSE····· ' MOMENTARILY SHOW
·PULSELEFT = 850······ ' "NO OBJECT" AS THE
·PULSERIGHT = 650····· ' BOE-BOT IS ADJUSTING
·ENDIF·········· ' ITS POSITION.
·PULSOUT 13,PULSELEFT···· ' APPLY THE PULSE.
·PULSOUT 12,PULSERIGHT
·PAUSE 15······ ' 5 MS FOR DETECTORS
·' CHECK IRS AGAIN IN CASE OBJECT IS MOVING
·GOSUB CHECK_IRS
·LOOP
·'
{ SUBROUTINES }
·CHECK_IRS:
·FREQOUT 8, 1, 38500····· ' CHECK IR DETECTORS
·IRDETECTLEFT = IN9
·FREQOUT 2, 1, 38500
·IRDETECTRIGHT = IN0
·RETURN

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-28 09:04
    lockadoc -

    Your compiler directive is faulty. Delete the original, and replace it with this one:
    ' {PBASIC 2.5}

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-03-28 13:09
    Bruce Bates said...
    lockadoc -

    Your compiler directive is faulty. Delete the original, and replace it with this one:
    ' {PBASIC 2.5}

    Regards,

    Bruce Bates

    Sorry, but I believe that should be:

    ' {$PBASIC 2.5}
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-28 13:42
    pwssr -

    Thanks for correcting it, my cut-and-paste was of the wrong directive <sigh>. I ended up with both in the test program and I grabbed the wrong one.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-03-28 14:35
    Bruce Bates said...
    pwssr -

    Thanks for correcting it, my cut-and-paste was of the wrong directive <sigh>. I ended up with both in the test program and I grabbed the wrong one.

    Regards,

    Bruce Bates

    I've done the same thing MANY times!!

    You're welcome.

    Paul
  • lockadoclockadoc Posts: 115
    edited 2006-03-29 07:27
    To: pwssr , Bruce.

    Thanks for the quick reply, You were CORRECT.

    ································· lockadoc , Bill
Sign In or Register to comment.