Shop OBEX P1 Docs P2 Docs Learn Events
BS1 Code — Parallax Forums

BS1 Code

Blackbird455Blackbird455 Posts: 124
edited 2007-08-22 03:54 in BASIC Stamp
Is there a more efficient way to write this:


· SYMBOL· reps··· = W1··················· ' FOR...NEXT loop counter
Main:
FOR reps = 0 TO 65535 STEP 3000······ ' each loop add 3000
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 20
HIGH 2
PAUSE 20
LOW 2
PAUSE 100
HIGH 1
PAUSE 50
LOW 1
PAUSE 20
HIGH 1
PAUSE 50
LOW 1
PAUSE 20
HIGH 1
PAUSE 50
LOW 1
PAUSE 20
HIGH 1
PAUSE 50
LOW 1
PAUSE 200
NEXT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-21 23:50
    How about:
    for reps = 0 TO 65535 STEP 3000
    for i = 1 to 16
    toggle 2
    pause 20
    next
    pause 80
    for i = 1 to 4
    high 1
    pause 20
    low 1
    pause 50
    next
    pause 150
    next
    
    
  • Blackbird455Blackbird455 Posts: 124
    edited 2007-08-22 02:53
    Mike ,



    · When I tokenize,· "undefined variable" for the "i" :



    · FOR i = 1 TO 16

    Is this just another Noob mistake on my behalf?
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2007-08-22 03:54
    You need to define I as a variable. I think its something like:
    SYMBOL i = W1 '(Or what ever variable size you need, I don't program in basic 1 so I don't know)
Sign In or Register to comment.