Shop OBEX P1 Docs P2 Docs Learn Events
BS Manual Button - error p.139 — Parallax Forums

BS Manual Button - error p.139

rh3drh3d Posts: 14
edited 2010-03-17 04:51 in Learn with BlocklyProp
Hi,

Error: 129-Expected ':' or end-of-line

Trying to use this Code from the BS Manual book below on my BS2.
Its erroring at BTN below!?

' {$STAMP BS1}
' {$PBASIC 1.0}
'Button
'Connect an active

SYMBOL·· Btn···· = 0
SYMBOL·· btnWrk· = B2
Main:
· ' Try changing the delay value (200) in BUTTON to see the effect of
· ' its modes: 0 = no delay; 1-254 = varying delays before auto-repeat;
· ' 255 = no auto-repeat (only one action per button press)
· '
· ' The BUTTON instruction will cause the program to branch to
· ' No_Press unless P0 = 0
· PAUSE 5
· BUTTON Btn, 0, 200, 20, btnWrk, 0, No__Press
· DEBUG "*"
No_Press:
· GOTO Main

Also I would love to hear why this is happening, I have searched around the forums and have not found anything.· Is Btn is only a function for BS1?

Comments

  • Jessica UelmenJessica Uelmen Posts: 490
    edited 2010-03-16 16:22
    Hi rh3d,

    In this code, Btn is not a function, it's a pin declaration. In order to use pin declarations with the BS2, you would use the PIN directive. So your code would look like this:

    Btn   PIN   0
    



    SYMBOL is a directive that's specific to the BS1 that's used to declare variables, pins, or constants. For the BS2 you use the directives VAR, PIN, or CON to accomplish these tasks.

    To adapt this code to the BS2, just flip the page in the manual (pg. 140).

    Hope this helps!

    -- Jessica

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jessica Uelmen
    Education Department
    Parallax Inc.
  • hover1hover1 Posts: 1,929
    edited 2010-03-16 16:22
    If you are using a BS2, you need to use the code on page 140.

    Jim


    OPS! Posted at the same time!

    Jim
  • rh3drh3d Posts: 14
    edited 2010-03-17 04:51
    I can't believe I missed this.. .. Thank you both. Got it working [noparse]:)[/noparse]

    Thanks for the explination Jessica, that was what I was looking for too.
Sign In or Register to comment.