Adding NodeMCU support to Arduino IDE

This guide will help you program the NodeMCU using the Arduino IDE.

Step 1: Connect Your NodeMCU to Your Computer

You need a USB micro B cable to connect the NodeMCU board to your computer. Once connected, a blue LED will start flashing.

If your computer does not detect the NodeMCU board, you may need to download the appropriate driver from the following link:

Step 2: Open Arduino IDE

Ensure you have Arduino IDE version 1.6.4 or later to proceed.

  1. Go to File > Preferences.

  2. In the "Additional Boards Manager URLs" field, type (or copy-paste) the following URL:

    http://arduino.esp8266.com/stable/package_esp8266com_index.json
  3. Click OK.

  4. Now, go to Tools > Board > Board Manager.

  5. In the search field, type "esp8266".

  6. You should see an entry named "esp8266 by ESP8266 Community". Click on it and press the Install button on the lower right.

Once the download is complete, you're ready to start coding!

For our first program, we will blink an LED connected to one of the digital pins of the NodeMCU board. Note: The pin names printed on the board may differ from the pin names used in the program.

In this example, we'll connect the LED to D7, which corresponds to GPIO13. Below is the code (which is a modified version of the Arduino Blink example):

// The setup function runs once when you press reset or power the board
void setup() {
  // Initialize digital pin 13 (D7) as an output.
  pinMode(13, OUTPUT);
}

// The loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // Turn the LED on (HIGH is the voltage level)
  delay(1000);              // Wait for one second
  digitalWrite(13, LOW);    // Turn the LED off by making the voltage LOW
  delay(1000);              // Wait for one second
}

NodeMCU Pin Mapping

  • In this example, D7 (as printed on the board) corresponds to GPIO13 in the code.

Ensure that the LED is connected to the correct pin as per the board's pinout.

Last updated