Shop OBEX P1 Docs P2 Docs Learn Events
Problems with TestLeftFrequencySweep.bs2 -- Getting errors with the DO...LOOP command — Parallax Forums

Problems with TestLeftFrequencySweep.bs2 -- Getting errors with the DO...LOOP command

eMarston15eMarston15 Posts: 3
edited 2014-04-16 06:46 in Accessories
Hey, everyone. I recently started Chapter 8 in the Boe-Bot activities guide, and I had some problems with TestLeftFrequencySweep.bs2 (below). Whenever I run it, it'll highlight the LOOP and tell me it expected a variable, label, or NEXT. But when I change it to NEXT, it highlights the DO and says I have a DO without a LOOP... Any suggestions/fixes I can make to the script?

—————————————————————————————————————————————————————

'
[ Title ]
' Robotics with the Boe-Bot - TestLeftFrequencySweep.bs2
' Test IR detector distance responses to frequency sweep.

' {$STAMP BS2}
' {$PBASIC 2.5}

'
[ Variables ]

freqSelect VAR Nib
irFrequency VAR Word
irDetect VAR Bit
distance VAR Nib

'
[ Initialization ]

DEBUG CLS,
" OBJECT", CR,
"FREQUENCY DETECTED", CR,
"

"

'
[ Main Routine ]

DO

distance = 0

FOR freqSelect = 0 TO 4

LOOKUP freqSelect, [37500,38250,39500,40500,41500], irFrequency
FREQOUT 8,1, irDetect
irDetect = IN9
distance = distance + irDetect

DEBUG CRSRXY, 4, (freqSelect +3), DEC5 irFrequency
DEBUG CRSRXY, 11, freqSelect + 3

IF (irDetect = 0) THEN DEBUG "Yes" ELSE DEBUG "No "

PAUSE 100

DEBUG CR,
"

", CR,
"Zone ", DEC1 distance
LOOP

—————————————————————————————————————————

Thanks for anything you guys can find that I missed. Any help would be appreciated.

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-04-16 06:46
    Welcome to the forum!

    Your missing a "NEXT" command above the the "LOOP". It's in the text. You must have missed it while typing.
Sign In or Register to comment.