Program
eagle
Posts: 6
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
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
Comments
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.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering