Illuminated buttons on a Leonardo… how many?

ubermick:
Great point, Lar3ry - now that I'm using 5v rather than the 3.3v, I can set up the LEDs in an 8x2 array. But are you sure about the current wiring them that way? If my admittedly basic level of circuitry is right, it basically acts the same as having 8 LEDs, which would be drawing 160mA?

Yes, I am absolutely sure of the current. Heck, it even looks like the Wizard agrees with me. 8)

The reason it works is this.

An LED, as you increase the forward voltage, will not start to conduct until it reaches a certain voltage (different LEDs will have different points at which they conduct. Red is about the lowest, Blue the highest, (in common LEDs). If you then increase the voltage supplied, the LED will still maintain the voltage it started conducting at. Yes, the voltage will rise slightly, but the current will increase a LOT. So, after the LED starts conducting, the only thing that changes is the current, and more current equates to brighter light. See the attached picture.

Putting two in series and increasing the voltage, will cause each LED to reach its turn-on point, the they will clamp the voltage to double the amount that one LED will. Let's say they are LEDs that conduct at exactly 2 volts. two in series will conduct at 4 volts, and you can calculate the resistor by subtracting 4 from the total voltage supply, and applying ohms law, so 5-4 = 1 volt left to drop, and to set the current at, let's say 20 mA, so R = E/I or R = 1/.20, or 50 ohms

led_curve.png