How to program ESP8266 nodeMCU with Arduino IDE | LED Blink

Esp8266-nodeMCU-programming-with-Arduino-IDE


In this post we”ll learn how easily we can program our ESP8266 NodeMCU with Arduino IDE we will upload a simple sketch of LED blink to ESP8266 board

It is very simple to load code to ESP8266 using Arduino IDE same as we are doing for Arduino boards but first we need to do a simple step of adding ESP8266 board in Arduino IDE.

Adding ESP8266 Board in arduino IDE

First of all off-course we need to download Arduino IDE to upload codes to if you already installed it in your computer you can move ahead.
or you can download it from here.

First install the IDE on you PC and open the IDE, now go to
FILE > PREFERENCES

Esp8266 nodeMCU Arduino IDE
Esp8266 nodeMCU Arduino IDE



Now go to the “Additional boards manager URLs”
and past this link there :
http://arduino.esp8266.com/stable/package_esp8266com_index.json
and click on OK.

Esp8266 nodeMCU Arduino IDE
Esp8266 nodeMCU Arduino IDE



Now go to : Tools > Board > Board manager

Esp8266 nodeMCU Arduino IDE
Esp8266 nodeMCU Arduino IDE



Now search for “ESP8266” and click on “Install” and wait for some time to install board to arduino IDE



In this way we successfully added ESP8266 board to our arduino IDE to verify you can go to : Tools > Boards and scroll to the bottom of list you will see whole list of new boards are live to be use.

Uploading code to ESP8266 NODEMCU

Simply connect the LED with ESP8266 board as shown in image
connect positive leg of LED TO D1 pin
and negative leg of LED to GND pin

ESP8266 nodeMCU LED Blink
ESP8266 LED blink

Simply connect the ESP8266 board to PC using Micro USB cable
Open the arduino and select the board which is “NodeMCU 1.0(ESP-12E Module)”

Select the proper port from here at which you ESP8266 nodeMCU is connected

Now upload the following code to ESP8266 simply by clicking on upload button.
after uploading the you will see LED start to blink with 1 second delay.

int LED = 5; // Assign LED pin i.e: D1 on NodeMCU

void setup() {

// initialize GPIO 5 as an output

pinMode(LED, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(LED, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off
delay(1000); // wait for a second

}

ESP8266 GPIO PINs Details in reference of ARDUINO IDE

ESP8266 GPIO PIN
ESP8266 GPIO PIN
ESP8266 nodemcu pin details
ESP8266 nodemcu pin details

Video