Skip to content

Instantly share code, notes, and snippets.

@compilerexe
Last active August 29, 2015 14:25
Show Gist options
  • Save compilerexe/9edb9ef7a60ad561a6cf to your computer and use it in GitHub Desktop.
Save compilerexe/9edb9ef7a60ad561a6cf to your computer and use it in GitHub Desktop.
ESP8266_WiFi_AP_Config
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
/*=== WiFiAccessPoint ===*/
const char* ssidAP = "__Your__WiFi__AP__"; // Change your name access point
const char* ssidPass = ""; // Change your password access point
const char* wifi_ip[4] = {"192", "168", "10", "200"}; // Change your ip local network
const char* wifi_subnet[4] = {"255", "255", "255", "0"}; // Change your subnet local network
const char* wifi_gateway[4] = {"192", "168", "10", "1"}; // Change your gateway local network
ESP8266WebServer server(80);
void WebServer_Config() {
server.on("/", webserver_display);
server.begin();
Serial.println("HTTP server started");
}
void webserver_display() {
server.send(200, "text/html", "<h3><b>It's Work !</b></h3>");
}
void WiFi_AP() {
WiFi.softAP(ssidAP);
WiFi.softAPConfig(
IPAddress(atoi(wifi_ip[0]), atoi(wifi_ip[1]), atoi(wifi_ip[2]), atoi(wifi_ip[3])),
IPAddress(atoi(wifi_gateway[0]), atoi(wifi_gateway[1]), atoi(wifi_gateway[2]), atoi(wifi_gateway[3])),
IPAddress(atoi(wifi_subnet[0]), atoi(wifi_subnet[1]), atoi(wifi_subnet[2]), atoi(wifi_subnet[3]))
);
Serial.print("WiFi AP : ");
Serial.print(ssidAP);
Serial.println();
Serial.println("WiFi AP Success");
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
}
void setup(void) {
Serial.begin(115200);
WiFi_AP();
WebServer_Config();
}
void loop(void) {
server.handleClient();
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment