mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
配网的WIFI名称随机
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
|
|
||||||
const char *ap_ssid = "wumei-device6";
|
String randomName="wumei-device"+(String)random(1000);
|
||||||
|
const char *ap_ssid =randomName.c_str();
|
||||||
const char *ap_password = ""; //开放式网络
|
const char *ap_password = ""; //开放式网络
|
||||||
|
|
||||||
char sta_ssid[32] = {0};
|
char sta_ssid[32] = {0};
|
||||||
@@ -24,7 +25,7 @@ ESP8266WebServer server(80);
|
|||||||
void setup(void)
|
void setup(void)
|
||||||
{
|
{
|
||||||
//打开串行端口:
|
//打开串行端口:
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
// AP模式
|
// AP模式
|
||||||
initApConfig();
|
initApConfig();
|
||||||
// web服务
|
// web服务
|
||||||
@@ -45,7 +46,7 @@ void initApConfig()
|
|||||||
WiFi.mode(WIFI_AP_STA);
|
WiFi.mode(WIFI_AP_STA);
|
||||||
WiFi.softAPConfig(local_IP, gateway, subnet);
|
WiFi.softAPConfig(local_IP, gateway, subnet);
|
||||||
WiFi.softAP(ap_ssid, ap_password);
|
WiFi.softAP(ap_ssid, ap_password);
|
||||||
printMsg("已启动AP配网,IP地址:" + WiFi.softAPIP().toString());
|
printMsg("已启动AP配网,IP地址:" + WiFi.softAPIP().toString()+", 热点名称:"+(String)ap_ssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user