How does one drive multiple LEDs and control them with the arduino? I need to control 3, and the way I currently have it set up is running 3 lamp-resistor setups in parallel from the 5v pin, and controlling them with a transistor hooked to a digital I/O pin between the 5v pin and the lamps. Should this work?
(I'm asking because I currently don't have components, inwhich case I would test and see.)
The way you use the NPN transistor, you will only get 4.3V maximum at its emitter. You're not fully using the available 5V. The LEDs will light up though. Usually you would put that kind of transistor after the LEDs, that is 5V---resistor---LED---transistor---GND. This becomes more important if you use e.g. 12V. The reason for this is that the base-emitter voltage (minus about 0.7V for the b-e diode) controls the transistor. If you connect the load to the emitter, the voltage drop across the load decreases the b-e voltage, ultimately 'choking' current flow. If you connect the load to the collector (as suggested), the base-emitter voltage is only determined by the base voltage (which comes from the arduino), which is always the same. Google/wikipedia has a lot of good stuff on that as well
The ULN2800 family of logic level input darlington arrays are sweet for lamp and relay driving, all have internal supression diodes so relays can be driven without need for external diodes. Convienient layout as all inputs are on same side of package as are all outputs on the opposite side of the package.