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
' {$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
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.
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
Comments
trying to do.
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
www.parallax.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
' {$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
'
' {$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