How to Blink a LED with ESP8266 NodeMCU

In this tutorial I am going to show you how to blink a LED using ESP8266 NodeMCU development board (version 1.0 in this case).

Parts Required

The ESP8266 NodeMCU v1.0 Pins

ESP8266 module is widely used in applications that need built-in Wifi, because of is lower size and price. Besides the Wifi capabilities this module also have a microcontroller Tensilica’s L106 Diamond of 32 bits. This module has lot of versions each one with different number of accessibles pins. The first version (ESP-01) had only 2 GPIOs and serial communication (TX and RX pins).
In this tutorial we will use NodeMCU v1.0 that is a development board to ESP8266 module (version 12-E).

Image available in link, accessed in March 2019

Building the Circuit and Schematic

In case you have the LED, the resistor and breadboard you can connect all together following the schematic below. Here we are using “D1” pin from NodeMCU that in fact is connected internally to the “GPIO5” from the ESP8266-12E module. To complete this tutorial you can also use the built-in LED of the NodeMCU board, which in this case is connected internally to the “GPIO16” from the ESP8266-12E module.


In this tutorial we will be using the Arduino IDE to program the ESP8266 NodeMCU. If you already used your Arduino IDE to program ESP8266 type boards you can skip to Step 4. If you want to know more details on how to do Step 1, Step 2 and Step 3 you can follow this tutorial of Arduino IDE.

Step 1: Start from open Arduino IDE. If you don´t have it installed yet you can download the last version from here:

Step 2: The first time you use ESP8266 based boards on Arduino IDE you need to add them to the boards manager. In “File -> Preferences” paste this link: and click “OK”.

Note: If you prefer using ESP32 module, just use the following link instead:

Step 3: Then you need to install them on “Tools -> Board -> Board Manager…”. Search by “esp8266” and install the last version of the boards.

Step 4: Select “NodeMCU 1.0 (ESP-12E Module)” board.

Step 5: Then copy the code bellow to your Arduino IDE project and save it. Connect your ESP8266 NodeMCU to your PC using micro-usb to usb cable and upload the code. In case you don´t have a LED you can use the built-in LED from the NodeMCU development board, just change the first line of the code bellow to “cons int led = 16;”

const int led = 5; //GPIO5

void setup() {
  pinMode(led, OUTPUT);

void loop() {
  digitalWrite(led, HIGH);
  digitalWrite(led, LOW);

8 thoughts on “How to Blink a LED with ESP8266 NodeMCU

  1. Hello there, just became alert to your blog through Google, and found that it is truly informative. I am gonna watch out for brussels. I’ll be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

  2. That is a good tip particularly to those fresh
    to the blogosphere. Short but very precise information… Thanks for sharing this one.
    A must read article!

  3. Wow that was odd. I just wrote an really long comment but after I
    clicked submit my comment didn’t appear. Grrrr…

    well I’m not writing all that over again. Regardless, just wanted to say superb blog!

    1. We apologize for the inconvenience, but comments are subject to approval before being published (it is a site policy), it probably took longer than normal. Thanks for the comment.

  4. I do agree with all of the concepts you have presented in your post. They’re very convincing and will certainly work. Still, the posts are very brief for starters. May you please lengthen them a little from subsequent time? Thank you for the post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!

Hello! We have noticed you are using an ad blocker. Our website is funded by advertising which allows you to access all our content for free. By disabling your ad blocker, you are contributing to the sustainability of our project and ensuring we continue to provide high-quality, useful tutorials. We appreciate your support!