IOT Protocols and Implementation - Sample Code for NodeMCU on Arduino (6)


// Choose the board type as NodeMCU 1.0 (ESP12-3 Module)

void setup()


// initialize digital pin 5 as an output. (Called D2 on the SOC)

pinMode(5, OUTPUT);


// the loop function runs over and over again forever

void loop() {

digitalWrite(5, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(5, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second