Hi
I have a HTML code that I want to upload that to my ESP module and see my web server in browser.
I can upload the image successfully and give the message Upload image Done
But I dont see anything except these messages in serial monitor:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
ets_main.c
and the code That I use in the IDE is:
to get som details about my code:
I connect to my home Wi-Fi and after that module gives me an IP address that when I print that in my browser the web server will shod.The first time I have try the web server By put my HTML in string and send it but after completing my web server I decide to use FS.
// Very basic Spiffs example, writing 10 strings to SPIFFS filesystem, and then read them back
// For SPIFFS doc see : https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md
// Compiled in Arduino 1.6.7. Runs OK on Wemos D1 ESP8266 board.
#include "FS.h"
#include <ESP8266WiFi.h>
const char* ssid = "Amir";
const char* password = "911183012";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
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());
bool ok = SPIFFS.begin();
if (ok) {
Serial.println("ok");
bool exist = SPIFFS.exists("/tabs.html");
if (exist) {
Serial.println("The file exists!");
File f = SPIFFS.open("/tabs.html", "r");
if (!f) {
Serial.println("Some thing went wrong trying to open the file...");
}
else {
int s = f.size();
Serial.printf("Size=%d\r\n", s);
String data = f.readString();
Serial.println(data);
f.close();
}
}
else {
Serial.println("No such file found.");
}
}
}
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();
delay(1);
Serial.println("Client disconnected");
}