I have an Arduino Uno whose LED, which is connected to pin 13, is not turning off and it always stays on, and it annoys me.

Arduino UNO

Touching any exposed pins turns off the LED after removing my hands from the pins it turns back on slowly.

However it works perfectly with the programs. This program does turn the LED off and it stays that way while the program is running.

void loop() {
  digitalWrite(13, LOW);         

When I upload other programs that don't use pin 13 then it stays on again. How can I fix this?


2 Answers 2


If you don't tell it to turn off, it behaves "as it wants". If you don't write a 0 on its pin, how can you force it to stay shut down?

If you want it to be in an off state, force it: in your setup function write

pinMode(13, OUTPUT);
digitalWrite(13, LOW);

No need to refresh it every loop, just in the setup.

  • Yeah i know. that was the example i am giving to tell it behaves that way when the pin is not defined/set. Means i have not set pinMode(13,OUTUPT/INPUT); and still it stays on.. but when i do define it with pinmode than it works the way it supposed to work
    – Skyyy
    Commented Nov 30, 2015 at 12:50
  • Yes, that's because if you want the board to do (or not to do) something you have to explicitely say it. Otherwise you will have a behavior that can change between runs
    – frarugi87
    Commented Nov 30, 2015 at 13:18
  • i have another arduio uno who doesn't behave like this one.. its led stays off.
    – Skyyy
    Commented Nov 30, 2015 at 16:11
  • Again, " you have to explicitely say it. Otherwise you will have a behavior that can change between runs". If you don't tell it to pull it down, it will be in a floating state. Floating means that no one knows what state it will have. So pull it down. Or solder a resistor (any value above 10k are fine) between the 13 pad and ground. Or place a resistor of the same value in the header between pin 13 and ground. But you have to set a value
    – frarugi87
    Commented Nov 30, 2015 at 16:29

You could try to actually remove the LED with a soldering pen... I haven't tried it however, so you could end up disabling pin 13 (or worst).

  • That's my last option..
    – Skyyy
    Commented Nov 30, 2015 at 12:52
  • 1
    As I referred to in my comment on the question ( arduino.stackexchange.com/questions/17675/… ) this behaviour is normal because of the op-amp they use to drive the LED. The output state is undefined if the pin is configured as an input, and the op-amp may or may not turn on the LED. To be sure, configure the pin as an output. Soldering a resistor or removing the LED seems an overkill. Define the pin as an output if it is not used for anything else, and write LOW to it.
    – Nick Gammon
    Commented Nov 30, 2015 at 20:11
  • 1
    @AkashKumar you could just put a small square of electrical tape over it, which is also temporary. Don't overthink it! Commented Nov 30, 2015 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.