Arduino Pro and Arduino Pro Mini, pin 13 initialized as output
landret opened this issue · 1 comments
landret commented
Hi,
pin 13 is unexpecteadly initialized as output. This code shows that the on board led on pin 13 blinks, without the pin being set as output in the code.
void setup(){}
void loop()
{
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
}
PaulStoffregen commented
This is a well known behavior of the classic AVR hardware. The pins default to INPUT mode if not configured with pinMode(), and when in that mode, writing to the output enables/disables the internal pullup resistor (which is normally accessed by pinMode with INPUT_PULLUP).
If you add pinMode(13, OUTPUT), you will see the LED is much brighter. When driven only by the weak internal pullup resistor, the LED still works but is quite dim.
Again, this is a well known behavior of the older AVR hardware. It is not a software bug.