and have the pins connected so they attach to the led positive in, a series 20ohm resistor, and then ground on the Arduino MEGA board. When I read the voltage from pin 2 to ground directly I get 5volts but when I connect them to the resistor, I only get 3.6 volts. Approximately 0.7 over the led and 2.9V over the resistor. Does anyone know why this is happening?
johnwasser:
Your series resistor is WAY too small. You are drawing 145 mA (2.9 Volts / 20 Ohms) from a pin that has an absolute maximum rating of 40 mA!
Thank you! I didn't even think of that, the LED isn't even in the final project. I was just using it for testing of code, I grabbed a resistor out of the network and put it in series without even thinking about it but yes that was the reason.
On a note of the voltage, your right. I reversed them. The resistors only dropping 700-800mV, and the LEDs dropping the rest. I'm not sure why the led is dropping so much, perhaps because the resistor was so low.