Using Platform.io to blink a NodeMCU’s LED.

Recently, I discovered Platform.io which is a set of tools integrated in Atom editor. It allows the VERY easy management of tool chains for multiple boards. Here is my first program.

First, create a new project using the menu : "PlatformIO > Initialize or Update a Platform.io project ...". Choose NodeMCU board in the assistant then add a src/main.cpp file with following content.

#include <Arduino.h>

const int LED = D0; // GPIO 16

void setup() {
 // Init LED pin as an output
 pinMode(LED, OUTPUT);

// Welcome message
 Serial.begin(9600);
 Serial.print("Hello world");
}

void loop() {
 digitalWrite(LED, LOW);
 delay(1000);
 digitalWrite(LED, HIGH);
 delay(1000);
}

Use the build and upload commands from Platform.io toolbar or menu and done !
This was an easy one, wasn’t it ? All the tool chain installation crap is handled by Platform.io, awesome.

Leave a Reply

Your email address will not be published. Required fields are marked *