NodeMCU · ESP8266 · Windows
ESP8266 First Blink
Install the Arduino IDE, add ESP8266 board support, wire one LED, and upload a
blink program to a NodeMCU board. About 20 minutes, no prior Arduino experience needed.
YOU NEED
- NodeMCU board (the ESP-12E/F module is the metal-shielded IC on it)
- Micro-USB data cable — some charging cables have no data wires and will silently fail
- One LED, one 330Ω resistor (anything from 220Ω to 2K works), two jumper wires
- A Windows PC with internet
STEP 1
Install the Arduino IDE
- Go to arduino.cc/en/software and download the latest Arduino IDE for Windows (the "Win 10 and newer" installer).
- Run the installer and accept the defaults. If Windows asks to install device drivers during setup, allow it.
- Start the IDE once so it finishes its first-run setup.
STEP 2
Tell the IDE where ESP8266 boards live
The IDE only knows official Arduino boards out of the box. Add the ESP8266 package index:
- Open File > Preferences.
- Find the field Additional boards manager URLs and paste in:
https://arduino.esp8266.com/stable/package_esp8266com_index.json
Click OK.
STEP 3
Install the ESP8266 board package
- Open Tools > Board > Boards Manager (or click the circuit-board icon in the left sidebar).
- Search for
esp8266.
- Install "esp8266 by ESP8266 Community". The download is a few hundred MB of compilers and takes a few minutes.
STEP 4
Plug in the board and select it
- Connect the NodeMCU to the PC with the micro-USB cable. A small LED on the board lights up.
- Select Tools > Board > esp8266 > NodeMCU 1.0 (ESP-12E Module). This entry is correct for ESP-12F modules too.
- Select the board's port under Tools > Port — it appears as a COM port (e.g. COM4). If you're not sure which one, unplug the board and see which port disappears.
- Set Tools > Upload Speed > 921600. This makes uploads take ~3 seconds instead of ~20.
NO PORT SHOWING? The board's USB-serial chip (usually a CH340) may need a driver.
Search for "CH340 driver windows", install it, and replug the board. And double-check the cable is a data cable.
STEP 5
Wire the LED
The LED connects to pin D1 through the resistor:
D1pin on board
──
330Ωresistor
──
LEDlong leg in, short leg out
──
GNDpin on board
- The LED has a direction: the long leg (anode) goes toward the resistor and D1, the short leg (flat side of the rim) goes to GND. Backwards it simply won't light — nothing breaks.
- Resistor direction doesn't matter, and it can sit on either side of the LED.
- Any GND pin on the board works; there are several.
PIN CHOICE MATTERS. Stick to D1 or D2 for experiments. D3, D4, and D8 are boot-mode
pins — loads on them can stop the board from starting or flashing.
STEP 6
The blink program
Open File > New Sketch, delete what's there, and paste this in:
// blink8266 - NodeMCU / ESP-12F
// onboard LED on GPIO2 (D4) is active low, external LED on D1 is active high
const int led = 2;
const int extLed = D1;
void setup() {
pinMode(led, OUTPUT);
pinMode(extLed, OUTPUT);
}
void loop() {
digitalWrite(led, LOW);
digitalWrite(extLed, HIGH);
delay(500);
digitalWrite(led, HIGH);
digitalWrite(extLed, LOW);
delay(500);
}
Save it as blink8266 (Ctrl+S).
Why two LEDs and opposite levels: the board's built-in blue LED is wired
between the pin and 3.3V, so writing LOW turns it on. Your LED is wired between the pin and
ground, so HIGH turns it on. The program drives them with opposite levels so they blink alternately.
STEP 7
Upload and watch it blink
- Click the Upload button (the right-arrow, top left). The IDE compiles for ~15 seconds, then the board's LED flickers rapidly while the program transfers.
- When the output window says "Hash of data verified", the program starts immediately.
You should see: your LED and the small blue LED on the board blinking once per second, alternating — when one is on, the other is off.
⚠
If something doesn't work
| Symptom | Fix |
| No COM port | Install the CH340 driver; try a different USB cable (must be a data cable) and a rear USB port. |
| Upload fails / times out | Set Upload Speed back to 115200 and retry. Still failing: hold the board's FLASH button, tap RST, release FLASH, then upload. |
| Compile error mentions D1 | The wrong board is selected. Re-check Step 4 — it must be NodeMCU 1.0, not a generic Arduino. |
| Board LED blinks, yours doesn't | LED is probably backwards — swap its legs. Then check the wire really is on D1 (the D-labels are printed on the board edge). |
| Nothing blinks after upload | Press the RST button on the board. If still nothing, re-upload and watch for errors in the output window. |