How to make an html page using ESP8266

0

I have written a program on Arduino IDE to make an HTML page. It is getting compiled as well as getting upload on my ESP8266. But I get no any HTML page in browser whenever I try to enter into it with the IP address serial provided on the serial monitor. Kindly help me to find the problem if there is any either in my code or in the headerfile which is in current directory . Following is my code,

#include<ESP8266WiFi.h>
#include<WiFiClient.h>
#include<ESP8266WebServer.h>

#include "index.h"

const char * ssid = "Nadeem";
const char *password = "hamzalaiba";
ESP8266WebServer server(80);

void handleRoot() {
String s = MAIN_page; //Read HTML contents
 server.send(200, "text/html", s); //Send web page
}

void setup(){
  Serial.begin(9600);
  delay(10);
  Serial.print("Connecting to\n");
  Serial.print(ssid);
  WiFi.begin(ssid,password);
  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Wifi connected");
  delay(10);
  Serial.print("Your server IP address: ");
  Serial.println(WiFi.localIP());
  server.on("/",handleRoot);
  server.begin();
  Serial.println("Server Started");
}
void loop(){
  server.handleClient();
}

The headerfile 'index.h' contains following codes ,

const char MAIN_PAGE[] PROGMEM = R"=====(
<HTML>
    <HEAD>
            <TITLE>My first web page</TITLE>
    </HEAD>
<BODY>
    <CENTER>
            <B>Hello Zain.... </B>
    </CENTER>   
</BODY>
</HTML>
)====="; 

The output I get on serial monitor have following stuff,

......
Wifi connected
Your server IP address: 192.168.10.13
Server Started

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (3):
epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4023d559 depc=0x00000000

.>>>stack>>>

ctx: cont
sp: 3ffffd00 end: 3fffffc0 offset: 0190
3ffffe90:  00000001 3ffee38c 4023d559 4020574b  
3ffffea0:  3ffef450 00000001 3ffef24c 402031aa  
3ffffeb0:  3fffff00 3fffff10 80fffef0 40201b50  
3ffffec0:  00000001 40208230 3ffffef0 402081fe  
3ffffed0:  3fffff10 3ffee3a8 3ffef24c 401000e1  
3ffffee0:  3ffef24c 3ffee3a8 3ffef24c 40201b88  
3ffffef0:  3ffe0000 3fff0000 80000001 80fe84ec  
3fffff00:  3ffef24c 3ffee3a8 3ffee368 402031fe  
3fffff10:  0000002f 80000000 81fefb00 0000008f  
3fffff20:  80005054 388a21b4 40100200 00002ade  
3fffff30:  3ffee3a8 00000000 00000001 00000001  
3fffff40:  00000001 3ffef24c 3ffee368 3ffee500  
3fffff50:  00000001 3ffee38c 3ffee368 3ffee500  
3fffff60:  00000001 3ffee38c 3ffee368 40203497  
3fffff70:  00000000 00000000 00001388 80efeffe  
3fffff80:  00000000 00000000 00000001 40100170  
3fffff90:  3fffdad0 00000000 3ffee4c0 40203538  
3fffffa0:  3fffdad0 00000000 3ffee4c0 4020668c  
3fffffb0:  feefeffe feefeffe 3ffe84ec 40100ba1  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------
V)⸮L⸮⸮D⸮⸮Connecting to
Nadeem...........
Wifi connected
Your server IP address: 192.168.10.13
Server Started
arduino-ide
arduino-esp8266
asked on Stack Overflow Oct 13, 2020 by Zain Ul haq • edited Oct 14, 2020 by Marcel Stör

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0