Arduino PWM only putting out 3.6Volts

I'm using the command

analogWrite(ledManual, 255);

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?

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!

a series 20ohm resistor,

You probably want to read the datasheet.

Approximately 0.7 over the led

Are you sure of that? Most visible light LEDs have a minimum voltage of at least 1.2V. Is it an IR LED?

If you need to drive your LED that hard you need a transistor.

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.

I'm not sure why the led is dropping so much, perhaps because the resistor was so low.

Perhaps it's the color of the led you are using as they have very different Vf ratings between the color choices.

So what kind of led are you using?

Lefty