Flash NodeMCU dev board with Arduino Sketch

  1. Download official Arduino IDE 1.6.5, and install it on your laptop.
  2. Open Arduino IDE, choose File->Preference->Additional Boards Manager URLs. Then add the url: http://arduino.esp8266.com/versions/2.1.0-rc2/package_esp8266com_index.json
  3. Open Tools->Board->Boards Manager, wait a minute, select ESP8266 items, Install.
  4. Waiting until the installation finishes, and select the NodeMCU board you use from board list (I’m using NodeMCU v0.9, so I selected that). Select the serial port you use to flash the board (I’m using the USB serial port).

5. Write some code, upload the sketch and test!



The process worked for me. But I also saw other people mentioning press the flash and user buttons to flash. I didn’t need to do that, and it worked.

Remaining issue

the pin numbers I use do not seem match the ones on the dev board. I’m still trying to figure out why. For example, when I set output pin to 0, nothing happens. When I set to 1, the tiny blue LED on board is on. When I set to 2, my LED will light up after I move the wire to pin 4 on the board.

Update 1/31/2016

I found this github page mentioning the pin remapping. Actually, the ESP8266 library we installed actually has this remapping defined in the header file, e.g.


static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t D9 = 3;
static const uint8_t D10 = 1;

So I changed my code to the following, and the pins are matched.

int outputPin = D1;

void setup() {
 pinMode(outputPin, OUTPUT);
void loop() {
 digitalWrite(outputPin, HIGH);
 digitalWrite(outputPin, LOW);