四博智联产品售后
标题:
设置Wifi热点
[打印本页]
作者:
ycf
时间:
2015-12-28 18:06
标题:
设置Wifi热点
/*
可以将您的espduino设置为wifi热点(Soft AP 模式)
*/
#include <ESP8266WiFi.h>
/* Create a WiFi access point and provide a web server on it. */
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
/* Set these to your desired credentials. */
const char *ssid = "Charlie Testing AP";
const char *password = "11111111";
ESP8266WebServer server(80);
/* Just a little test message. Go to http://192.168.4.1 in a web browser
* connected to this access point to see it.
*/
void handleRoot() {
server.send(200, "text/html", "<h1>You are connected</h1>");
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
}
复制代码
欢迎光临 四博智联产品售后 (http://115.29.109.104/)
Powered by Discuz! X3.2