We are in general agreement and I think both of us misunderstood each other. We have two different approaches for avoiding the D10 output HIGH issue when offering backlight on/off control. One method involves a hardware mod and s/w while the other is s/w only.
Your first explanation was not clear enough to me to be able to tell how you were intending to use the output pin since you didn't fully describe it. From your first description it appeared that you were just setting the pin to INPUT and nothing else. I now see that you intended to control the backlight on/off.
However, this approach and the s/w only approach from response #3 both have the same issue of a "short" when D10 is an output and driven HIGH. The reason is exactly the same whether the resistor is present or not. (No current limiting from D10 into the base).
i.e. if s/w is loaded into the board that programs D10 as output and drives it high BOOM... There is a problem - regardless of whether the resistor is removed.
So while either method can offer on/off backlight control, neither protects the hardware from damage and neither can support PWM because the first thing analogWrite() does is make the pin an output as it turns on PWM which will be driving the pin high.
The difference between the two is that one requires a hardware mod AND special/odd s/w and the other is only special/odd s/w.
The h/w and s/w method: - cut/remove resistor under LCD - possibly add weak pulldown resistor to D10
- set D10 to INPUT
- turn on pullup to turn on backlight (AVR m328 spec says 20k to 50k, worst case of 50k is that enough to turn on the transistor for backlight? .1ma ?)
- turn off pullup to turn off backlight.
Alternatively with IDE 1.0.1 and beyond the s/w part reduces to be: (with no initial setting of D10 to any state or level)
pinMode(D10, INPUT); // turn off backlight pinMode(D10, INPUT_PULLUP); //turn on backlight
The s/w only method: - set D10 to LOW (only once) - set D10 to OUTPUT for backlight off - set D10 to INPUT for backlight on
Alternatively, with any version of IDE this reduces to: (with no initial setting of D10 to any state or level)
pinMode(D10, OUTPUT); // turn off backlight pinMode(D10, INPUT); // turn on backlight
This works because OUTPUT sets the output of the pin to LOW as well which will pull the transistor base down which will turn off the backlight. Since the pullup still in place on the LCD shield, there is no need to turn on the D10 pullup, just setting it to INPUT mode will allow the shield pullup to drive the transistor to turn on the backlight.
Given both methods have the same limitations and they both reduce down to very similar s/w operations to control the backlight, my preference would be for a s/w only solution.
I had talked to fm just after I started this thread about adding support for this s/w only method to the lcd library as an option but we came the conclusion that there is no guarantee that the user will provide the correct information to the constructor. And since you really can't tell things are broken, because it seems to work, when you are shorting out the D10 pin by driving it HIGH, we opted not to provide it. (Its also a strange and very narrow usage case as well)