LED_BUILTIN is on even when I don't choose it lol

Hey and tx in advance

I was running the fade sketch with an LED on PWM pin 9.
Anyway, I noticed the LED_BUILTIN was fading aswell.

How do I stop the LED_BUILTIN from turning on when i haven't called for it?

Explicitly digitalWrite() it low in setup().

(I do that in some templates, since having it on annoys the carp out of me. In other templates I use it as a proof of life bwod.)

But it's odd that yours is affected by another pin. It's especially odd that on Uno type boards, pin13 isn't pwm so how can it fade.

What board do you have and maybe show the code?

On Arduino board that have an op amp connected to LED_BUILTIN, when that pin is set to INPUT mode the LED reflects the state of the floating input pin. It's possible that the pin is being influenced by the electrical noise from the PWM signal on pin 9 and it's circuit. The solution is to set the LED_BUILTIN pin as an output (or INPUT_PULLUP) in setup():

pinMode(LED_BUILTIN, OUTPUT);

The advantage of setting the pin mode as OUTPUT is then you can chose whether the pin is HIGH or LOW (and thus control whether the built-in LED is on or off). The disadvantage of it being an output is you need to be careful not to short that pin, otherwise you will damage the microcontroller. For this reason, INPUT or INPUT_PULLUP mode is safer.

12Stepper:
Explicitly digitalWrite() it low in setup().

But you see, unless you also set it to OUTPUT, it will still be a floating input as it is LOW on initialisation.

If on the other hand, you digitalWrite() it HIGH, as an input it will then be INPUT_PULLUP and absent any other connection to the pin, the "L" LED will stay illuminated - which may be almost as annoying as the bright power LED! :astonished:

Hey everyone.
Well, it's just an example sketch - File/Examples/Basic/Fade.

@12Stepper yea I know, I was on pin9 as well as pin11 and LED_BUILTIN was fading in both instances lol.
I'm going to use digitalWrite(LED_BUILTIN, LOW) and see how that goes. Thx for the tip.

@Pert Thanks for teaching me about why that happens. I didn't understand the whole pull up pull down thing but I know what your talking about. Long as I can set it low ya know. Thx for the lesson.

@Paul__B Waaaay over my head lol but thanks.

I'll check this out when I get home.