>

ESP8266-NodeMCU食用指南

基础知识 WIFI模式 接入点模式 esp8266作为接入点,其他设备通过wifi与esp8266连接。 示例: /* 此程序用于演示如何将NodeMCU以接入点模式工作。通过此程序,您可以使用 电脑或者手机连接NodeMCU所建立WiFi网络。 */ #include <ESP8266WiFi.h> // 本程序使用ESP8266WiFi库 const char* ssid = "wifi_name"; const char* password = "12345678"; // 如果建立的WiFi不要密码,则在双引号内不要填入任何信息 void setup() { Serial.begin(9600); // 启动串口通讯 WiFi.softAP(ssid, password); // 此语句是重点。WiFi.softAP用于启动NodeMCU的AP模式。 Serial.print("Access Point: "); // 通过串口监视器输出信息 Serial.println(ssid); // 告知用户NodeMCU所建立的WiFi名 Serial.print("IP address: "); // 以及NodeMCU的IP地址 Serial.println(WiFi.softAPIP()); // 通过调用WiFi.softAPIP()可以得到NodeMCU的IP地址 } void loop() { } 无线终端模式 esp8266与路由器连接。 /* 此程序用于演示如何将NodeMcu以接入点模式工作 */ #include <ESP8266WiFi.h> const char* ssid = "wifi_name"; const char* password = "pswd"; void setup(){ Serial....

September 20, 2023 · 3 min