Shop OBEX P1 Docs P2 Docs Learn Events
Program — Parallax Forums

Program

eagleeagle Posts: 6
edited 2008-09-15 21:30 in BASIC Stamp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-15 17:04
    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.
  • eagleeagle Posts: 6
    edited 2008-09-15 17:41
    Mike, thank you for your quick response. I give both methods a try. I do appreciate your input.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-09-15 21:30
    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
Sign In or Register to comment.