Hi all,
why is this?
I set all pins to input on my UNO Rev. 3. Now the built-in LED is on when I expected it to be off
void setup(){
for(byte pin = 0; pin < 20; pin++){
pinMode (pin, INPUT);
}
}
void loop(){
}
Hi all,
why is this?
I set all pins to input on my UNO Rev. 3. Now the built-in LED is on when I expected it to be off
void setup(){
for(byte pin = 0; pin < 20; pin++){
pinMode (pin, INPUT);
}
}
void loop(){
}
Have you turned on pullup resistors?
If you make a pin an input then you put it into a high impedance state. If you set the pullup and connect an LED to an input pin then enough current will flow to make it glow very dimly.
Since there is a hard wired LED on pin 13 then setting it to an input will light the LED dimly.
Is it bright or dim.
If it is dim then it is because you have the pin as an input. That means it is a floating high impedance and leakage current could be lighting the LED. Make it an output and it will go off or connect something to it.
By the way don't use pins 0 & 1 because that screws up the serial communications.
it is really bright as if it were set to output and HIGH. My intention was to save power in sleep mode, so I set all pins to input and only the output pins to OUTPUT later on. Is this wrong?
Concerning pins 0 and 1: I am calling Serial.begin later in my sketch. Does that set the pins right again?
On a rev3 Uno the pin 13 led is driven by a opamp section acting like a buffer, and I'm not sure one can always rely on the design to always be light off when the pin 13 is in input mode, as it's kind of like a 'floating input pin' condition. Try wiring a 1 meg ohm resistor from pin 13 to ground to see if that forces the led off.
Lefty
On a rev3 Uno the pin 13 led is driven by a opamp section acting like a buffer,
Well I never so it is.
That explains it all, I missed that one.
I suspect they did it because it is part of the SPI group of pins and the LED was a load on the pin that maybe interfered with the operation of some SPI devices.
Well done Lefty
Grumpy_Mike:
On a rev3 Uno the pin 13 led is driven by a opamp section acting like a buffer,
Well I never so it is.
That explains it all, I missed that one.I suspect they did it because it is part of the SPI group of pins and the LED was a load on the pin that maybe interfered with the operation of some SPI devices.
Well done Lefty
This was discussed a couple of days ago on this board, but without anyone actually trying a high value pull-down. Lots of people reporting that they load a sketch that does not use pin 13 at all and sometimes the pin13 would stay on and sometimes it would stay off, so very confusing to them.
I guess it's a case of good intentions (unloading led load from SPI clock signal) having a unintended consequence, led 13 is now not always off when not being used unless you place pin 13 to output and set LOW.
Lefty
I am having exactly the same problem. I was more than surprised when you posted it was driven by an opamp.
A 470k resistor from 13 to ground tamed it. Maybe should be a built in pull down across it?
smeezekitty:
I am having exactly the same problem. I was more than surprised when you posted it was driven by an opamp.A 470k resistor from 13 to ground tamed it. Maybe should be a built in pull down across it?
As they are presently up to rev3 for the Uno, I see no reason not to expect a rev4 one fine day. Lets face it, sooner or later they are going to get it right. ![]()
Lefty
retrolefty:
On a rev3 Uno the pin 13 led is driven by a opamp section acting like a buffer, and I'm not sure one can always rely on the design to always be light off when the pin 13 is in input mode, as it's kind of like a 'floating input pin' condition. Try wiring a 1 meg ohm resistor from pin 13 to ground to see if that forces the led off.Lefty
Pulling the pin down solved it, thanks.