Shop OBEX P1 Docs P2 Docs Learn Events
missing label — Parallax Forums

missing label

Robert.ITRobert.IT Posts: 13
edited 2004-12-19 19:24 in BASIC Stamp
When I go to run and check the syntax, it highlights the word CON in my code and says label missing. How can I Fix this?

Comments

  • dandreaedandreae Posts: 1,375
    edited 2004-12-18 21:06
    Can you give us a sample of your code?· This will allow us to see what you
    trying to do.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-18 21:30
    CON is not a keyword in $PBASIC 1.0 syntax -- if you're using a BS1 then you must use SYMBOL for everything. If you're writing a program for the BS2 family, make sure you're syntax level is set to 2.0 or 2.5.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Robert.ITRobert.IT Posts: 13
    edited 2004-12-19 18:58
    here is the code. If you could please help.

    ' {$STAMP BS1}
    ' Whiskers.bs2 - Simple program for detecting objects
    ' with a Basic Stamp II in a Boe-Bot

    ' Constant and Variable Definitions
    '
    servo_left con 15 ' left servo on p15
    servo_right con 14 ' right servo on p15
    whisker left var in10 ' left whisker on P10
    whiskert_right var in5 ' right whisker on P5
    counter var word ' loop counter variable

    ' main Program
    '
    check whiskers: ' check each whisker
    IF whicker_left = 0 AND whisker_right = 0 THEN back
    IF whisker_left = 0 THEN right
    IF whisker right = 0 THEN left

    drive servos: ' drive forware
    PULSOUT servo_left,850
    PULSOUT servo right,650
    PULSOUT 10
    GOTO check_whiskers

    back: ' backward if both switches close
    FOR counter = 0 TO 100
    PULSOUT servo_left,650
    PULSOUT servo_right,850
    NEXT
    RETURN
    GOTO drive servos

    left: ' turn left if right switch closes
    GOSUB back
    FOR counter = 0 TO 100
    PULSOUT servo left,650
    PULSOUT servo_right,650
    NEXT
    GOTO drive servos

    right: ' turn right if left switch closes
    GOSUB back
    FOR coutner = 0 TO 100
    PULSOUT servo left,850
    PULSOUT servo_right,850
    NEXT
    GOTO drive_servos
    '
  • OrionOrion Posts: 236
    edited 2004-12-19 19:02
    First thing I see is your declaring a BS1 in your first line, yet the comments say its a bs2 program.· I think the CON works only on the BS2 and higher.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-19 19:24
    You're telling the editor that you want to program a BS1, yet you're using BS2 code. Change your module definition to {$STAMP BS2}. You can also change the servo and whisker defintions to PIN, but be sure you're using 2.5 syntax. In short, put these lines at the top of your program:

    ' {$STAMP BS2} -- this replaces current definition
    ' {$PBASIC 2.5} -- this allows PIN and other programming conveniences (see help file)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.