Shop OBEX P1 Docs P2 Docs Learn Events
loop question — Parallax Forums

loop question

ArchiverArchiver Posts: 46,084
edited 2004-02-15 17:02 in General Discussion
James-

I'm going to take a guess that you're not using PBASIC 2.5, in which
case the editor considers "do" and "loop" as merely labels. As a
result, it generates no syntax errors but doesn't treat the code
segment as a do-loop. Your Stamp is executing as if the program
source code were:

start:

high 14
pause 1000
low 14
pause 1000

quit:

Grab the latest editor from the Parallax site and specify the PBASIC
2.5 directive.

Regards,

Steve

On 14 Feb 04 at 20:14, pstarckt wrote:

> Just aquired a stamp 'homework' board. I'm working through the book
> and when I tried the 'do-loop' program, it would only run once and
> stop. It would run correctly if I added the for and next modifiers
> but not by themselves as the book says. Is there a misprint and I
> have the syntax wrong? The book program looks like this:
>
> do
>
> high 14
> pause 1000
> low 14
> pause 1000
>
> loop

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-02-14 20:14
    Just aquired a stamp 'homework' board. I'm working through the book
    and when I tried the 'do-loop' program, it would only run once and
    stop. It would run correctly if I added the for and next modifiers
    but not by themselves as the book says. Is there a misprint and I
    have the syntax wrong? The book program looks like this:

    do

    high 14
    pause 1000
    low 14
    pause 1000

    loop

    Any help would be appreciated!

    James
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-15 01:37
    I think you need to change the line

    loop

    to

    goto loop

    I don't use the stamp much these days, I am sure some of the experts will
    correct me if wrong
    Just aquired a stamp 'homework' board. I'm working through the book
    and when I tried the 'do-loop' program, it would only run once and
    stop. It would run correctly if I added the for and next modifiers
    but not by themselves as the book says. Is there a misprint and I
    have the syntax wrong? The book program looks like this:

    do

    high 14
    pause 1000
    low 14
    pause 1000

    loop

    Any help would be appreciated!

    James


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-15 17:02
    Be sure you have the latest version of the Parallax development
    software. Go to,

    <http://www.parallax.com/html_pages/downloads/software/software_basic_stamp.asp>
    and download "BASIC Stamp Windows Editor version 2.1 Beta"

    You probably have an older version now, that is treating "DO" and
    "LOOP" as ordinary labels, so the program only runs through once.

    The alternative is to replace "loop" with "goto top" and include the
    "top" label.

    -- Tracy


    >Just aquired a stamp 'homework' board. I'm working through the book
    >and when I tried the 'do-loop' program, it would only run once and
    >stop. It would run correctly if I added the for and next modifiers
    >but not by themselves as the book says. Is there a misprint and I
    >have the syntax wrong? The book program looks like this:
    >
    >do
    >
    >high 14
    >pause 1000
    >low 14
    >pause 1000
    >
    >loop
    >
    >Any help would be appreciated!
    >
    >James
Sign In or Register to comment.