Con function confusion....
troika
Posts: 14
HELLO,
PASTED BELOW IS MY (1ST EVER) SCRIPT.
I AM CONTROLLING A NUMBER OF REED SWITCHES.
WHEN I TRY TO RUN THIS TO THE STAMP I GET:
Expected a constand! with PRESS CON HIGH with 'HIGH' hi-lited
i just want to substitute PRESS for HIGH and RELEASE for LOW
thanks
troika
' {$STAMP BS2}
' {$PBASIC 2.5}
TIMES VAR BYTE
DIR0=1
DIR1=1
DIR2=1
DIR3=1
DIR4=1 ' make Pins 0-6 an output
DIR5=1
DIR6=1
POWER CON 3
MAGIC CON 0
MUTE CON 1 'names pin no.s as functions on remote
CHUP CON 6
CHDN CON 2
VOLUP CON 5
VOLDN CON 4
PRESS CON HIGH
RELEASE CON LOW
FOR TIMES = 0 - 3
PRESS CHUP
PAUSE 500
RELEASE CHUP
PAUSE 500
NEXT
PAUSE 20000 'CHANNEL UP 3 TIMES
PRESS VOLUP
PAUSE 5000
RELEASE VOLUP
PAUSE 500
FOR TIMES = 0 TO 20
PRESS MUTE
PAUSE 200
RELEASE MUTE
PAUSE 200
NEXT
PAUSE 22000
PRESS MUTE
PAUSE 500
RELEASE CHDN
PASTED BELOW IS MY (1ST EVER) SCRIPT.
I AM CONTROLLING A NUMBER OF REED SWITCHES.
WHEN I TRY TO RUN THIS TO THE STAMP I GET:
Expected a constand! with PRESS CON HIGH with 'HIGH' hi-lited
i just want to substitute PRESS for HIGH and RELEASE for LOW
thanks
troika
' {$STAMP BS2}
' {$PBASIC 2.5}
TIMES VAR BYTE
DIR0=1
DIR1=1
DIR2=1
DIR3=1
DIR4=1 ' make Pins 0-6 an output
DIR5=1
DIR6=1
POWER CON 3
MAGIC CON 0
MUTE CON 1 'names pin no.s as functions on remote
CHUP CON 6
CHDN CON 2
VOLUP CON 5
VOLDN CON 4
PRESS CON HIGH
RELEASE CON LOW
FOR TIMES = 0 - 3
PRESS CHUP
PAUSE 500
RELEASE CHUP
PAUSE 500
NEXT
PAUSE 20000 'CHANNEL UP 3 TIMES
PRESS VOLUP
PAUSE 5000
RELEASE VOLUP
PAUSE 500
FOR TIMES = 0 TO 20
PRESS MUTE
PAUSE 200
RELEASE MUTE
PAUSE 200
NEXT
PAUSE 22000
PRESS MUTE
PAUSE 500
RELEASE CHDN
Comments
·· You cannot define HIGH as a constant, since it's a PBASIC keyword.· As a side-note you will then get the same error for LOW.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
oh well
can i make a shortcut for
HIGH x PAUSE 500 LOW x PAUSE 500 (where x is the pin e.g. CHUP)
and name is something like: PRESS01
so i could run:
PRESS01 CHUP
for the whole function?
PRESS CON 1
RELEASE CON 0
Seems like this would work the same...Ad for using PAUSE with parameters you could say:
PAUSE 500 * PRESS
which would cause a 500 mS pause...or
PAUSE 500 * RELEASE
which would cause almost no pause.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support