Menu Close

Testing IOT devices Node MCU 8266

I will testing IOT Node MCU 8266 for begin, checking IOT working.

https://youtu.be/GT4dJC0gdNM

Can you copy code on below for testing your IOT devices working.

LED on device (Node MCU will flashing around 3 sec. and you can open Serial Monitor for checking again.

const int ledPin = LED_BUILTIN;
int timeOn = 1500;
int timeOff = 2000;
float totalTime = (timeOn + timeOff) / 1000;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  Serial.print("TestLED_Node8266 = ");

  Serial.print(totalTime);
  Serial.println(" second");

}

void loop() {
  digitalWrite(ledPin, LOW);
  Serial.println("led ON");
  delay(timeOn);
  digitalWrite(ledPin, HIGH);
  Serial.println("led OFF");
  delay(timeOff);

}

Posted in Book

Related Posts