9

Trying a simple led blinking program I could not get the builtin led on a LoLin Node MCU v3 working. The LED_BUILTIN constant is set to pin 16 / GPIO16 / D0.

Reading several articles and QA I think that the Node MCU boards are supposed to have a the on-board led on pin 16. However, if I address this port nothing happens.

With the same code I can blink the data led which is on a RX pin, pin 2.

Is the builtin led missing on the LoLin Node MCU v3, or could it be that the led on my board is broken?

  • This question is downvoted. Could someone please share what is wrong with it? – Jan H Oct 2 '17 at 8:13
23

the ESP8266 has a builtin led that is attached to D4 as labeled on LoLin boards which maps to GPIO2. One thing to Note is that the led is active low. In other words ... setting PIN 2 to '0' will turn the LED ON and setting PIN 2 to '1' will turn the LED OFF

Lolin Builtin_Led Picture

This is the only LED on the LoLin boards and differs from other devkits that have an LED on GPIO16.

5

I have nodeMCU v3 and Pin 2 worked for me.

#define LED_BUILTIN 2

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because 
                                    // it is acive low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}
0

The NodeMCU with the CP2102 serial and a slightly narrower pin footprint does have 2 LEDs.

$led1 = BUILTIN_LED;  //D0, 16, BUILTIN_LED: OnBoard LED
$led2 = 2;    //Pin 5 D4/2 Internal LED for LoLin V3

The $led1 = BUILTIN_LED (on GPIO 16) is **not* on the LoLin NodeMCU v3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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