I am making a wifi(Access Point ) for my android app to connect with it.
But unfortunately, Everytime I turn off the arduino, and reconnect, The wifi Isn't there.
I always need to Flash the code(Below) in order for my android phone to detect the wifi and connect with it.
#include <ESP8266WiFi.h>
WiFiServer server(80); //Initialize the server on Port 80
void setup() {
WiFi.mode(WIFI_AP); //Our ESP8266-12E is an AccessPoint
WiFi.softAP("ELECTRIPID", "12345678"); // Provide the (SSID, password); .
server.begin(); // Start the HTTP Server
//Looking under the hood
Serial.begin(115200); //Start communication between the ESP8266-12E and the monitor window
IPAddress HTTPS_ServerIP= WiFi.softAPIP(); // Obtain the IP of the Server
Serial.print("Server IP is: "); // Print the IP to the monitor window
Serial.println(HTTPS_ServerIP);
}
void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}
//Looking under the hood
Serial.println("Somebody has connected :)");
String s = "HTTP/1.1 200 OK\r\n";
s+= "Content-Type: text/html\r\n\r\n";
s+= "<!DOCTYPE html>";
s+= "<html>";
s+= "<head>";
s+= "<title>Page Title</title>";
s+= "</head>";
s+= "<body>";
s+= "<h1>ELECTRIPID</h1>";
s+= "<p>WIFI TEST.</p>";
s+= "</body>";
s+= "</html>";
client.flush();
client.print(s);
delay(1);
Serial.println("Client Disconnected");
}