What is NodeMCU Programming How to Use It

1:19 PM

 

NodeMCU, a board frequently used in IoT (Internet of Things) applications, is an open source firmware and development kit. It offers the best platform for IOT application development at the lowest cost. You can open the doors of the wireless world wide with the ESP8266-12 WiFi module integrated on it.

You can easily perform many applications according to your imagination in a wide range of areas, from device control over the Internet or network to transferring sensor information from one point to another device.

You can find the pin connections below.

What is NodeMCU Programming How to Use It

You can easily program it in the Arduino IDE program. Before you start programming, copy and paste the following link to the Additional Manager Boards URL in the Arduino IDE in Additional File>Options.

http://arduino.esp8266.com/stable/package_esp8266com_index.json

What is NodeMCU Programming How to Use It

Then download the ESP8266's library from the link below and add it to your Arduino IDE. For this, choose the file you downloaded by going to Sketch>Include Library>Add .ZIP Library. The library will be added automatically.

https://github.com/esp8266/Arduino

Plug your USB OTG cable into NodeMCU and connect to the computer. Just like writing a program to Arduino, don't forget to choose your board as Node MCU before going to the upload part!

What is NodeMCU Programming How to Use It

You can examine the WiFi Scan code in the library and below, which we have added as a sample code. In the future, I will share with you friends by making more detailed and advanced applications. Bye now.

#include "ESP8266WiFi.h"
void setup() {
  Serial.begin(115200);

  // Set WiFi to station mode and disconnect from an AP if it was previously connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  Serial.println("Setup done");
}

void loop() {
  Serial.println("scan start");

  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0)
    Serial.println("no networks found");
  else
  {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i)
    {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i)); // wifi name
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i)); // signal strength
      Serial.print(") MAC:");
      Serial.print(WiFi.BSSIDstr(i));
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" Unsecured":" Secured");
      delay(10);
    }
  }
  Serial.println("");

  // Wait a bit before scanning again
  delay(5000);
}

Next Article
« Prev Post
Previous Article
Next Post »
Disqus
Tambahkan komentar Anda

No comments