PDA

View Full Version : Program



eagle
09-15-2008, 11:52 PM
http://forums.parallax.com/images/smilies/smhair.gif Attached is the file for the software. In early tests individually on the leds, worked properly. Individual test on the standard servo motor, worked properly. Combining the two creates a bug. Comes up with "expecting variable"
I have tried making all commands (FOR counter) but hen the servo does not respond properly. When I make all (For LP) expect variable comes up.
I am a newbie to this and do not understand how to make the correction. Attached is the file where I combined the two.

DEBUG "Program Running"
Counter VAR Byte
'DO
'----------------------------------- Activate basic servo to open
For LP = 1 TO 90
Low 14
PULSOUT 14, 20
Pause 20
'----------------------------------- Fade in first LED
NEXT
LOW 5
For counter = 0 to 127
PULSOUT 6, 1
PAUSE 40
'----------------------------------- Fade in second LED
NEXT
LOW 12
For counter = 0 to 127
PULSOUT 13, 1
PAUSE 40
'----------------------------------- Activate sound board relay
NEXT
High 15
PAUSE 500
Low 15
'----------------------------------- Fade out first LED
NEXT
HIGH 5
For counter = 0 to 127
PULSOUT 6, 1
PAUSE 40
'----------------------------------- Fade out second LED
NEXT
HIGH 12
For counter = 0 to 127
PULSOUT 13, 1
PAUSE 40
'----------------------------------- 'Activate basic servo close
NEXT
For LP = 1 TO 90
Low 14
PULSOUT 14, 20
Pause 20
NEXT
'LOOP

Mike Green
09-16-2008, 12:04 AM
Just like you have a declaration for the variable "counter", you need a declaration for the variable "LP".
You can simply add a second declaration just like the one for "counter", but for "LP" or you could in
this case use the variable "counter" for everything since there's no interference. Just replace "LP"
with "counter" in the two For statements.

eagle
09-16-2008, 12:41 AM
Mike, thank you for your quick response. I give both methods a try. I do appreciate your input.

Chris Savage
09-16-2008, 04:30 AM
Hello, in the future please try to provide an more descriptive subject line on your posts and attach full programs rather than pasting the whole code into the message window. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering