coding LEDS in parallel to one pin - LILYPAD

hey guyss,

im kinda new at this and im not sure how to code several LEDs to one pin and cause them all to fade or dim down their brightness. Im using the arduino lilypad so the only analog pins i have are 5,6, A5 and A0 and its not enough to program my 15leds.

can someone please tell me how to code at least 2 leds in parallel connected to a single pin? thanks

There is nothing to do, you just code it like a single LED. The two LEDs will fade exactly together. The LEDs need there own resistor and will need to be switched by a transistor if you draw more than 35mA or so from the pin.

thankss! i was also wondering, on arduino.cc they say that each port has a maximum current capacity of 40mA...so when i connect say 3 leds in parallel, is the current of each BRANCH 40mA or will it be less by current division? im a bit confused because there are a bunch of sites that say connecting more than 2 leds in parallel will cause your leds to blow but i dont understand how that would happen if current is getting smaller and the voltage drop is staying the same..

could you please lend an explanation?

At 40mA current draw your arduino pin starts being damaged. So you must make sure that the current is below this point. As most LEDs can be run at 20mA that is where you get the 2 LEDs rule from. However, it depends on the resistor you use with the LED how much current you let it draw. So if you only draw 10mA per LED you can have up to four of them in parallel. Each LED needs it's own resistor, it is the resistor / LED combination you put in parallel. You do not put the raw LEDs in parallel because they will not share current evenly, one will take more than the other and so could put too much current down it.

but i dont understand how that would happen if current is getting smaller

How can the current get smaller?

well because its a parallel circuit so the current is dividing with every branch....right?

nigguhslice: well because its a parallel circuit so the current is dividing with every branch....right?

No.