Shop OBEX P1 Docs P2 Docs Learn Events
Error Messege — Parallax Forums

Error Messege

ArchiverArchiver Posts: 46,084
edited 2004-04-17 13:19 in General Discussion
Hi,
I'm fairly new to Pbasic and I am trying to use the basic stamp to
operate a robot. I am working on a program that makes a robot find
light using a CdS cell. Anyway, I am using the "POT" command to read
the Cds, and the "IF...THEN" command to decide what to do, but I keep
getting this "Expected a label" error. So here's the part of the
program that keeps giving me trouble. I would really appreciate it if
someone would look over the program and find out what I'm doing wrong.

' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL Value = B2


POT 1, 110, value
IF value > 200 THEN PULSOUT PIN 5,200000

Thanks,

Thane

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-17 04:56
    Just remove the PIN so the Pulse command reads "PULSOUT 5, 200000".
    PBasic sees two commands without any arguments. That label error is
    almost always a syntax error or a typo. Both are subjects I excel at!

    --- In basicstamps@yahoogroups.com, "Elizabeth Hunt" <jnhunt1@a...>
    wrote:
    > Hi,
    > I'm fairly new to Pbasic and I am trying to use the basic stamp to
    > operate a robot. I am working on a program that makes a robot find
    > light using a CdS cell. Anyway, I am using the "POT" command to
    read
    > the Cds, and the "IF...THEN" command to decide what to do, but I
    keep
    > getting this "Expected a label" error. So here's the part of the
    > program that keeps giving me trouble. I would really appreciate it
    if
    > someone would look over the program and find out what I'm doing
    wrong.
    >
    > ' {$STAMP BS1}
    > ' {$PBASIC 1.0}
    > SYMBOL Value = B2
    >
    >
    > POT 1, 110, value
    > IF value > 200 THEN PULSOUT PIN 5,200000
    >
    > Thanks,
    >
    > Thane
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-17 13:19
    PBASIC 1 does not allow active code after IF-THEN, the only thing you
    can do is make a program jump. Change your program like this:

    POT 1, 110, value
    IF value <= 200 THEN No_Output
    PULSOUT 5, 2000

    No_Output:

    Be sure to look at the manual or help file ... your PUSLOUT parameter is
    much larger than allowed.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Elizabeth Hunt [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=mRez1b960IoYyApoJzyfQhu2zLvkZZPOdUrY2hP2v8kHbilBBgdbkGdQTBKfRJrOk7vcCiUBwEpl3QjrLEev]jnhunt1@a...[/url
    Sent: Friday, April 16, 2004 9:39 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Error Messege "Expected a label"


    Hi,
    I'm fairly new to Pbasic and I am trying to use the basic stamp to
    operate a robot. I am working on a program that makes a robot find light
    using a CdS cell. Anyway, I am using the "POT" command to read the Cds,
    and the "IF...THEN" command to decide what to do, but I keep
    getting this "Expected a label" error. So here's the part of the
    program that keeps giving me trouble. I would really appreciate it if
    someone would look over the program and find out what I'm doing wrong.

    ' {$STAMP BS1}
    ' {$PBASIC 1.0}
    SYMBOL Value = B2


    POT 1, 110, value
    IF value > 200 THEN PULSOUT PIN 5,200000

    Thanks,

    Thane
Sign In or Register to comment.