Thursday, March 15, 2012

How I did the Knight Rider Style LED Chaser using the basic stamp

So I was asked how I did the cyclon/knight rider stlye chasing LEDs using the basic stamp.
These two videos pretty much explain it, but I also said I would post the code, so here it is.






Cylon Chaser Lights:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 9
PAUSE 50
LOW 0
LOW 9
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 4
HIGH 5
PAUSE 50

LOW 4
LOW 5
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 0
HIGH 9
PAUSE 50

LOOP

Knight Rider Stlye Chaser LED:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 1
HIGH 2
PAUSE 50
LOW 0
HIGH 3
PAUSE 50
LOW 1
HIGH 4
PAUSE 50
LOW 2
HIGH 5
PAUSE 50
LOW 3
HIGH 6
PAUSE 50
LOW 4
HIGH 7
PAUSE 50
LOW 5
HIGH 8
PAUSE 50
LOW 6
HIGH 9
PAUSE 50

LOW 9
HIGH 6
PAUSE 50
LOW 8
HIGH 5
PAUSE 50
LOW 7
HIGH 4
PAUSE 50
LOW 6
HIGH 3
PAUSE 50
LOW 5
HIGH 2
PAUSE 50
LOW 4
HIGH 1
PAUSE 50

LOOP