Powering Leds
manwithgun0100
Posts: 2
I don't know where i should post this. Let me know if its in the wrong spot.
I'm working on a Christmas project using a gingerbread house, leds, and the Basic Stamp HomeWork Board. I thought about soldering together about 10-20 leds with a 470K resistor for the Christmas lights and running it using the code below. I used 3 leds and the beeper to troubleshoot with and it work pretty good.
Any help would be appreciated.
' {$STAMP BS2}
' {$PBASIC 2.5}
' Ginger Bread House Music Code 2008
' Created by manwithgun4
'Song 1 - Jingle Bells
l2 CON 2500
l23 CON 13000
l3 CON 10000
l32 CON 7000
l4 CON 5000
i VAR Word
DO
IF IN13 = 1 THEN
FOR i = 0 TO 1
LOW 0
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 150, l3 :HIGH 14
PAUSE 300 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 150, l3 :HIGH 14
PAUSE 300 : LOW 14
FREQOUT 9, 100, l3:HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l2 : HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9, 100, L4 : HIGH 0
PAUSE 150 : LOW 0
FREQOUT 9,100, L32 : HIGH 0 :HIGH 1 : HIGH 14
PAUSE 150 : LOW 0 :LOW 1 : LOW 14
PAUSE 20
HIGH 1 : FREQOUT 9,400, l3
PAUSE 150 : LOW 1
FREQOUT 9,100, L23 :HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23 :HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150:LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, l3:HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9,100, l3:HIGH 1
PAUSE 200:LOW 1
FREQOUT 9, 300, l3:HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9,100, l3:HIGH 1
PAUSE 150:LOW 1
FREQOUT 9,100, L32:HIGH 14
PAUSE 150 :LOW 14
FREQOUT 9,100, L32:HIGH 14
PAUSE 150 :LOW 14
FREQOUT 9,100, l3:HIGH 1
PAUSE 150:LOW 1
HIGH 14 :FREQOUT 9,400, L32
PAUSE 155 : LOW 14
HIGH 0:HIGH 1: HIGH 14 :FREQOUT 9,400, 9000
PAUSE 150 :LOW 1
NEXT
ELSE
DO WHILE IN13 = 0
HIGH 0
PAUSE 300
LOW 0: HIGH 1
PAUSE 300
LOW 1: HIGH 14
PAUSE 300 :LOW 14
LOOP
ENDIF
LOOP
Post Edited (manwithgun0100) : 12/19/2008 8:40:36 PM GMT
I'm working on a Christmas project using a gingerbread house, leds, and the Basic Stamp HomeWork Board. I thought about soldering together about 10-20 leds with a 470K resistor for the Christmas lights and running it using the code below. I used 3 leds and the beeper to troubleshoot with and it work pretty good.
Any help would be appreciated.
' {$STAMP BS2}
' {$PBASIC 2.5}
' Ginger Bread House Music Code 2008
' Created by manwithgun4
'Song 1 - Jingle Bells
l2 CON 2500
l23 CON 13000
l3 CON 10000
l32 CON 7000
l4 CON 5000
i VAR Word
DO
IF IN13 = 1 THEN
FOR i = 0 TO 1
LOW 0
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 150, l3 :HIGH 14
PAUSE 300 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l3 :HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 150, l3 :HIGH 14
PAUSE 300 : LOW 14
FREQOUT 9, 100, l3:HIGH 14
PAUSE 150 : LOW 14
FREQOUT 9, 100, l2 : HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9, 100, L4 : HIGH 0
PAUSE 150 : LOW 0
FREQOUT 9,100, L32 : HIGH 0 :HIGH 1 : HIGH 14
PAUSE 150 : LOW 0 :LOW 1 : LOW 14
PAUSE 20
HIGH 1 : FREQOUT 9,400, l3
PAUSE 150 : LOW 1
FREQOUT 9,100, L23 :HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23 :HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150:LOW 0
FREQOUT 9,100, L23:HIGH 0
PAUSE 150 :LOW 0
FREQOUT 9,100, l3:HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9,100, l3:HIGH 1
PAUSE 200:LOW 1
FREQOUT 9, 300, l3:HIGH 1
PAUSE 150 :LOW 1
FREQOUT 9,100, l3:HIGH 1
PAUSE 150:LOW 1
FREQOUT 9,100, L32:HIGH 14
PAUSE 150 :LOW 14
FREQOUT 9,100, L32:HIGH 14
PAUSE 150 :LOW 14
FREQOUT 9,100, l3:HIGH 1
PAUSE 150:LOW 1
HIGH 14 :FREQOUT 9,400, L32
PAUSE 155 : LOW 14
HIGH 0:HIGH 1: HIGH 14 :FREQOUT 9,400, 9000
PAUSE 150 :LOW 1
NEXT
ELSE
DO WHILE IN13 = 0
HIGH 0
PAUSE 300
LOW 0: HIGH 1
PAUSE 300
LOW 1: HIGH 14
PAUSE 300 :LOW 14
LOOP
ENDIF
LOOP
Post Edited (manwithgun0100) : 12/19/2008 8:40:36 PM GMT
Comments
You may want to power the HomeWork Board from an AC adapter. If you're lighting 4 LEDs at a time, that will exhaust a 9V alkaline battery in maybe 2-4 hours.