Transistor Base Resistor Choices?

dkl65:
I know that resistors are needed to limit the current for LEDs. A have an IR LED that uses 1.6V @ 50mA. I could use a 100 ohm resistor to a I/O pin, but I/O pins are limited to 40mA. Can I use Transistor 1.png? Isn't the 1k ohm resistor on the base supposed to limit the collector current to about 50mA? I will be using the 2N3904 from before.

The 1K base resistor does indirectly limit the collector current, but to a rather unpredictable value, so it is not sufficient. You need a resistor in series with the LED. If you want to drive it at 50mA then the value should be (5 - 1.6 - 0.3)/0.05 = 62 ohms. The base resistor should be chosen to give about 5mA base current, so it needs to be around 820 ohms (1K is close enough).