|
- /*
- 可以将您的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();
- }
复制代码
|
|