How digitalWrite and analogWrite effect the brightness of LED

I am new to electronics and which means I am new to Arduino as well. I just got a Getting Started with Arduino Kit and have been going through the book Getting Started with Arduino that came with the kit. I am trying to learn why an LED is brighter when I use digitalWrite than the same LED when using analogWrite. The LED appears to be half as bright when using analogWrite with the colour set to 255 and pin 9. It is much brighter using pin 13 and digitalWrite. :~

Steven

LED is current current-driven device. With digitalWrite() LED is driven from GPIO Output scheme, but with analogWrite() it is from PWM Output scheme. They produce different current on hte output pin.

There should be no difference in brightness between a digitalWrite(pin, HIGH) and a analogWrite(pin, 255), both result with the output pin being on high (+5vdc) continuously. The actual brightness with those values is determined by the value of the series resistor used with the led and of course the efficiency of the specific led being used.

If you see a difference in brightness between those two conditions, then there is something else going on that you haven't detected or stated to us.

Lefty

Analog pins are HIGH impedance pins which mean's if they are configured to give power to external circuitry they are less capable than the LOW impedance digital pins 0-13(they can provide 5v @ 40mA to any circuitry competently ) ,could be this thing or else 20K pullup resistor's are there at each digital and analog pin

Nishant: Analog pins are HIGH impedance pins which mean's if they are configured to give power to external circuitry they are less capable than the LOW impedance digital pins 0-13(they can provide 5v @ 40mA to any circuitry competently ) ,could be this thing or else 20K pullup resistor's are there at each digital and analog pin

You need to become more familiar with the Arduino functions and terms. analogWrite() function uses a digital output pin as a PWM output and has the same output drive capabilities as a normal digital output pin, which it is. The OP was talking out using the Arduino analogWrite function, using the digital output pins that support the PWM analogWrite() function.

http://arduino.cc/en/Reference/AnalogWrite

Lefty

Summerman, did you declare both pins (9 and 13) to be OUTPUT pins? If the pin is not defined to be an output pin, the LED on the pin will be be as bright as when the pin IS defined as an output pin.