pwm for leds
rr
Posts: 63
does anyone have any sample code for controling led brightness with pwm or know where i can get more info??? also is it going to be possible to control multipul led circuits at the same time with pwm??? for example i would like to be able to have one cicuit of leds getting dimmer as another circuit of leds is getting brighter. i know the bs2 cannot do multipul tasks at the exact same time but can the code be layered to seem like it is??? thanks for all the help...
Comments
BTW -·I have code for a bs2 that controls the pak5.· I used it with tri-colored leds. As one color dims the next brightens, and so on.· Let me know if you want it.
Post Edited (Orion) : 4/15/2005 12:46:38 AM GMT
http://forums.parallax.com/attachment.php?attachmentid=37573
However, there is another way to use the Stamp PWM in linear mode that will let you drive more than one circuit. The PWM value is stored on a capacitor, and an op-amp buffer that. Don't let op-amps scare you. You can get 4 op amps in one 14 pin dip package (LM324). The attached diagram shows one way PWM can be converted to current to drive an LED.
For a program with different leds at different brightness levels, you would have several of these circuits. The Stamp program would move around a loop, refreshing and updating the PWM value for each LED in turn. The capacitors hold the value instructed until the next time the program comes around the loop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com