Download Arduino IDE and continue with the setup.



https://arduino.esp8266.com/stable/package_esp8266com_index.json// blink.ino - the on-board LED, which is wired backwards.
//
// LED_BUILTIN on the NodeMCU is GPIO2 (the D4 label), and it is wired to
// 3.3V rather than to ground. So LOW turns it ON and HIGH turns it OFF -
// the opposite of every Arduino example.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, LOW); // ON
delay(500);
digitalWrite(LED_BUILTIN, HIGH); // OFF
delay(500);
}// wifi.ino - join the network and print the address.
#include <ESP8266WiFi.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
void setup() {
Serial.begin(115200);
delay(100);
// STA mode explicitly: the ESP8266 remembers its last mode in flash, and a
// board left in AP mode by earlier firmware will not join anything.
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("connected, IP = ");
Serial.println(WiFi.localIP());
}
void loop() {}// webled.ino - a page with two links that switch the LED.
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
ESP8266WebServer server(80);
void sendPage() {
// digitalRead of an output returns what we last wrote. Remember the LED is
// inverted, so LOW is on.
String state = digitalRead(LED_BUILTIN) == LOW ? "ON" : "OFF";
String html =
"<!DOCTYPE html><html><head>"
"<meta name='viewport' content='width=device-width, initial-scale=1'>"
"<title>NodeMCU</title></head>"
"<body style='font-family:sans-serif;text-align:center;padding-top:3rem'>"
"<h1>LED is " + state + "</h1>"
"<p><a href='/on'>Turn on</a> <a href='/off'>Turn off</a></p>"
"</body></html>";
server.send(200, "text/html", html);
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // start off
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println();
Serial.print("http://");
Serial.println(WiFi.localIP());
server.on("/", sendPage);
server.on("/on", []() { digitalWrite(LED_BUILTIN, LOW); sendPage(); });
server.on("/off", []() { digitalWrite(LED_BUILTIN, HIGH); sendPage(); });
server.begin();
}
void loop() {
// Must be called often. A long delay() in loop() makes the board stop
// answering requests, which looks like the Wi-Fi dropping.
server.handleClient();
}