Dimming and Brightening an LED
DJmart
Posts: 3
How exactly, would I be able to code up a program, that will be able to make an LED very bright, to very dim or off?
In class we did a ramping program, for servos, but I can't seem to get it to work, even by changing the IO pins.
The LED's are on PIN 0 if that helps.
Thanks a bunch fellas
P.S Sorry for a request as first post
In class we did a ramping program, for servos, but I can't seem to get it to work, even by changing the IO pins.
The LED's are on PIN 0 if that helps.
Thanks a bunch fellas
P.S Sorry for a request as first post
Comments
Do you need three states: bright, dim, off? Or do you need a variable brightness? If it's the first case, you could power the same LED with two pins and use different resistors. For example. If you require a 220 ohm resistance for full brightness, you could use a 440 ohm resistor off P0 and a second 440 ohm resistor tied to P1. Then when you want full brightness, you could turn on both P0 and P1, but if you wanted it dimmer, you would just turn on 1 pin. You could vary the resistance to allow for just P0 to be brighter than just P1., etc.
You might need to add diodes so you don't feedback into the other pin, but that's a question better left for someone more knowledgeable than myself.
-Tom
Just experiment with some high and low commands.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
There is a simple code to fade an LED on and off...
You can always play with settings, etc, to get different effects.
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Post Edited (Ryan Clarke (Parallax)) : 6/2/2006 9:02:46 PM GMT
THank you VERY much for the quick reply!
EDIT:
is there a way i can increase the speed. Like so it does the dim speed, but loops quicker?
Post Edited (DJmart) : 6/2/2006 9:18:22 PM GMT
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
You can change the step speed, or you can change the ranges that x goes through-
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
I wish i had learned that command weeks ago!
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com