Project Zero


  • Blink the on-board Blue LED on the ESP8266 NodeMCU board
  • Setup the Arduino IDE software on your computer to be compatible with the NodeMCU board


  1. NodeMCU board (quantity: 1 no.)
  2. Micro USB cable A to B (quantity: 1 no.)
  3. Arduino IDE on your computer

Let’s Begin!

ESP8266 is classified under connected devices and is used to build many low-cost IOT applications. For this project, we will use one of the common forms of ESP8266 called the NodeMCU board.

NodeMCU is a form of ESP8266 using the ESP-12 module, which has an on-board microcontroller. It can directly be programmed using the Arduino IDE.


NodeMCU based on ESP-12 variant of ESP8266 WiFi chip


There is an on-board LED on the NodeMCU which is internally connected to the digital pin D0 (GPIO16). We can switch this LED ON and OFF by controlling the digital pin D0.


On-board LED connected to digital pin D0 of NodeMCU


Installing Arduino IDE and configuring for NodeMCU board functionality

To install the required files to program the NodeMCU using the Arduino IDE, follow the steps below.

Step 1: Download Arduino IDE from the official Arduino website: Download

Step 2: Install the software and connect the NodeMCU board to your computer using the micro USB cable.

Step 3: Start Arduino IDE and navigate to File -> Preferences.

Step 4: Copy the link below and paste it in the Additional Boards Manager URLs tab.


Click OK to close the preferences window.

Step 5: Navigate to Tools -> Board -> Boards Manager.

Step 6: In the Boards Manager window, type esp8266 by ESP8266 Community. Select it and install it onto the Arduino IDE

Step 7: Navigate back to Tools -> Board, find and select NodeMCU 1.0 (ESP-12E module) board.

Step 8: Go to Tools -> Port and choose the port that corresponds to your NodeMCU.

You can find this port number by opening the Device Manager from your computer’s Start Menu. From the list, look for the COM port number of USB-UART bridge or something similar.

In few computers, the UART port will not be present and hence cannot be detected, for that you have to download an USB to UART port converter from here.


Now that your installation process is completed, let us begin programming the NodeMCU using the Arduino IDE.

Coding on the Arduino IDE

In order to execute this project, we will use the following functions to code in the Arduino IDE.

void setup()

  • Any command you type in the void setup() function will only run once.
  • Syntax:

    void setup()
      Type your command here;

void loop()

  • Any command you type in the void loop() starts executing after void setup() is finished. The commands here will run infinite number of times unless you specify an exit condition to it.
  • Syntax:

    void loop()
      Type your command here;


  • A command pinMode() is used to set a specific pin to behave as either input or output.
  • Syntax: pinMode(pin,mode)
  • ‘pin’ indicates the specific pin number or a variable which denotes the pin number.
  • ‘mode’ can be either INPUT or OUTPUT.

For this project: the following command sets the LED_BUILTIN pin as an output



  • A command digitalWrite() is an output command. It sets the output of a digital pin either HIGH or LOW.
  • Syntax: digitalWrite(pin,value)
  • ‘pin’ indicates the pin number or a variable which denotes a pin number.
  • ‘value’ of LOW or HIGH. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.

For this project: the following command switches ON the LED (here LED_BUILTIN stores the number 16 for the NodeMCU).


The following command switches OFF the LED.



  • A command delay()pauses the program for a definite period of time.
  • Syntax: delay(ms)
  • ‘ms’ is the number of milliseconds you want the delay for.

For this project: the following command pauses the code for 1 second. This duration can be controlled.



For this project: we will now summarize the above mentioned functions.

  • Using pinMode(), the void setup() will look like this.
void setup() {
  • Using digitalWrite() and delay(), thevoid loop()function will look like this.
void loop() {
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LED_BUILTIN, HIGH);

Final code

Our final code will look like this.

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

Uploading the code

Step 1: Enter the final code in the Arduino IDE window.

  • When you click on New to open a new blank code in the Arduino IDE, you will get a new  window with two functions: void setup() and void loop()
  • You can either type commands as shown in the final code under void setup() and void loop() functions or 
  • Delete the contents of this window. Then copy and paste the final code in the Arduino IDE window.

Step 2: Compile/ verify the code by clicking on the verify button.

  • Make sure the Arduino Uno is connected to your computer
  • Check if the correct board and port is selected.

Step 3: Upload the code by clicking on the upload button, which is right next to the verify button.

  • The Arduino IDE provides a progress bar when it’s uploading.
  • After it is done, you will see “Done uploading” on the bottom left of your IDE.
  • If you encounter any errors, you need to go back to the code and fix the errors.

There you go!

The LED on the NodeMCU is an active low LED. After uploading the code, you can see the on-board Blue LED blink. Notice that the LED stays ON for one second (we have given LOW for one second) and OFF for two seconds (we have given HIGH for two seconds). This demonstrates the active low feature.


Blinking of the on-board Blue LED on the NodeMCU



Loader Loading...
EAD Logo Taking too long?
Reload Reload document
| Open Open in new tab

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.


Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved