Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML page it's not show in web Server #54

Open
LucasMazur opened this issue May 8, 2018 · 0 comments
Open

HTML page it's not show in web Server #54

LucasMazur opened this issue May 8, 2018 · 0 comments

Comments

@LucasMazur
Copy link

Hi, i have a simple problem but to me it's being so dificulty to resolve. It's start recently, i've nerver had tbis problema before, when I connect in NODEMCU web Server in my web (192.168.0.114, for example), the page that i've created in program doesn't show, follow the code bellow:

Note: The download was a succes and I already updated de NODEMCU firmware

`#include <ESP8266WiFi.h>

const char* ssid = "ssid";
const char* password = "password";

WiFiServer server(80);

void setup()
{
Serial.begin(115200);
delay(10);

      Serial.print("Connecting to ");
      Serial.println(ssid);

      WiFi.begin(ssid, password);

      while (WiFi.status() != WL_CONNECTED) 
      {
          delay(500);
          Serial.print(".");
      }

       Serial.println("");
       Serial.println("WiFi connected");

       server.begin();
       Serial.println("Server started");
       Serial.println(WiFi.localIP());

}

void loop()
{
WiFiClient client = server.available();
if (!client)
{
return;
}

    Serial.println("new client");
    while(!client.available())
    {
         delay(1);
    }

String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();

String buf = "";

buf += "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n";
buf += "<html lang="en"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>\r\n";
buf += "<title>ESP8266 Web Server</title>";
buf += "<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:80%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;}</style>";
buf += "";
buf += "

ESP8266 Web Server - System Logs

";
buf += "\n";

client.print(buf);
client.flush();

Serial.println("Client disonnected");
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant