 # Pin output questions

I'm pretty new to Arduino and building a project using RGB LEDs.

Question #1
My red LED requires 2.1volts and since the digital pins output at 3.3 volts I need a small resistor to step down the voltage. Can't say I fully understand the calculation but I came up with 60ohms. Does that seem correct?
(3.3-2.1)/.02

Question #2
The LEDs state they pull 20ma but the tech sheet says the Nano board provides 7ma per port. Is that correct. I'm guessing the LEDs will work but be dimmer because of the lower amps? Or do I need a minimum of 20ma? I'm powering the Arduino with a USB connection but I do not think that affects the output of the pins.

The LEDs are due this weekend but I thought I could shorten the learning curve.

Let's start with (2). The LEDs can pull 20 mA but they don't have to.

And then to (1), The resistor is there to limit the current to protect the pin, not to reduce the voltage. The pin can output 7 mA. So your calculation will be

`R = (V<sub>out</sub> - V<sub>fw</sub>) / I`
`R = (3.3 - 2.1) / 0.007 = 171 Ohm.`

You round to the nearest higher value (in general 180 Ohm resistor). Note that you will hardly notice the difference if you use e.g. 220 Ohm if 180 Ohm is not available.

Thank you for the explanation. I have a follow-up question

I included the description of the LEDs below

• Product Parameters: 29mm Long Lead / Red: DC 2.0-2.2V; Blue&Green: DC 3.0-3.2V (IF=20mA) / 0.06 Watts / 2pin / DIP LEDs

The voltage for the blue and green LEDs is 3.2v, do I need a resistor for them?

Yes, LEDs always need a resistor unless controlled by a constant current circuit which serves the same function, limiting the current flowing trough the LED. The reason is the following.

LEDs are semiconductors that will have a lower resistance when they heat up. When you switch on a LED the current will increase the temperature of the material, this lowers the resistance, which increases the current, increasing the temperature, ... until the LED gets destroyed.

Incandescent light bulbs have wire filaments that increase the resistance when they heat up. So, they automatically limit the current as they heat and therefore do not need a current limiting resistor.