BS Manual Button - error p.139
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?
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
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:
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.
Jim
OPS! Posted at the same time!
Jim
Thanks for the explination Jessica, that was what I was looking for too.