I have a project involving 4 reed switches and an RGB LED. They are all connected to an Arduino and the code basically says each time a magnet touches a reed switch it lights up with a specific color. I have a 220 ohm resistor in between each of the three cathode legs and it’s respective digital control pin. It was working fine and then the red Light stopped working. And then the green light stopped working a short time later. And then the blue light stopped working about a week later. The switches are still working fine so it’s definitely something going on with the LED’s. I have tried other LED’s and am having he same problem. Has anyone seen this before and maybe have an idea for a Solution for me! Thanks!
Too much current
It seems the LEDs get too much current. Most generic (3mm or 5mm) LEDs have a rating of around 20 mA (or 40 mA when duty-cycled).
Since you are using 220 ohm resistors, and the red LEDs have the lowest forward voltage (Vfd) they will burn out first. Assuming 1.8 V as Vfd for a red light:
(V - Vfd) = I * R <=> (V - 1.8) = 0.02 * 220 <=> V = 1.8 + 4.4 = 6.2 V
I assume that you use more than 6.2 V in your circuit (to drive the LEDs). You have to decrease the voltage, or use bigger resistors.
Too much heat
If the current is not too high, than heat can be a problem; this is mostly the case for higher powered LEDs. I have a bunch of 3W LEDs (in a premade package, bought as is), and the version without a fan makes them burn out too (not necessarily starting with red, but based on where the cooling is worst). So if you have your LEDs built in a case, and/or the LEDs use some power and the heat cannot go away, this can also cause problems. But seeing that your red LEDs first die first, I assume it's a current problem.
Power of resistors
Also take the power of the resistors into account (P = V * I, the cheapest resistors are 1/8 or 1/4 W).