void SX_WifiClass::_setup_server() {
//byte mac[6];
WiFi.mode(WIFI_AP_STA); //WIFI_STA
WiFi.softAPConfig(IPAddress(192, 168, 0, 1), IPAddress(192, 168, 0, 1), IPAddress(255, 255, 255, 0));
/*String ssid = "";
for (int i = 0; i < 6; i++) {
ssid += String(mac, HEX);
}
Serial.println("SSID: " + ssid);
Serial.println("ASS: " + pass);*/
WiFi.softAP("DHTMonitor http://192.168.0.1:8080");
/* You can remove the password parameter if you want the AP to be open. */
//WiFi.softAP(ssid.c_str(), pass.c_str());
_server.on("/", HTTP_GET, _handleRootGet);
_server.on("/", HTTP_POST, _handleRootPost); // if you add this subdirectory to your webserver call, you get text below
_server.begin();
Serial.println("HTTP server started.");
}
给你一个部分的代码。你参考一下上网自己找吧!很容易的! |