Builtin Led is alway working

Dear all,

can I completely switch off the Builtin LED? I a working with a Nano WiFi1010 and once I read a digital Input Pin, the BUILTIN LED turns on. I have not configured it in any case.
I am working on a battery powered project and I want to extend battery life.

Any Idea?

You have to disconnect the hardware by desoldering the LED or cutting a PCB trace. Or, don't use that pin except to configure the LED and turn it off.

I don't use that pin at all. I made a digitalWrite to turn it off, but without any success.

Please explain. The onboard LED called the "built in LED" usually works. Does your board have a power on LED? Is that what you mean? Most boards don't have one.

I don't use that pin at all.

once I read a digital Input Pin

seem to contradict

It works fine so far, but I do not want it on or HIGH state. It draws current from my battery.

Turn it off.

digitalWrite(LED_BUILTIN, LOW);

BUILTIN LED is assigned to Pin 13. I am using Pin 6 in order to read a Button state. Every time I read this Button state from Pin 6, the LED turns on.

Configure pin 13 as an output, and then turn it off.

1 Like

Hello Peter_Stuhr
Post your sketch, well formated, with well-tempered comments and in so called code tags "</>" to see how we can help.
Have a nice day and enjoy coding in C++.


int contactState = 0;  // variable for reading the pushbutton status


void setup() {
  pinMode(6, INPUT);

  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial);
}

void loop() {

 // read the state of the pushbutton value:
  contactState = digitalRead(6);

  
  // Check, obutton is pushed
  if (contactState == HIGH) 
    {
    Serial.println("Deckel wurde geöffnet :-)"); 
    }
  }

The BUILTIN_LED on an Uno is driven by an opAmp, so if you leave it as a floating input, some unknown voltage would get amplified and make it light up. Do as aarg says:

or wire pin 13 to ground.

(Interestingly, if you don't configure it as an output, you can use it as a logic probe: put a jumper in pin 13 and touch it to other signals in your circuit to read them on the LED)

This is my simple code.

I don't see it. Edit - I meant the code that attempts to fix the problem...

change to

void setup() {
  pinMode(6, INPUT);
// new
 pinMode (LED_BUILTIN,OUTPPUT);
 digitalWrite(LED_BUILTIN,LOW); 
//
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial);
}

OP is not using an Uno.

But the same might apply to his/her board.

1 Like

I included these 2 lines, but no effect. This BUILTIN LED turns on once I pushed the button.

What is that? I have heard of Nanos and I have heard of the MKR WiFi1010; but never of a Nano WiFi1010. Please provide a link to the product.

Impossible. They won't compile, they contain a typo.

check your hardware

I corrected the typo at OUTPUT. My board is a MKR WiFi1010