I have an error when I try to run my programming, I saw several tutorials and they all work, but mine is not working, could someone help me to identify the problem?
Follow my .cpp programming
Code: Select all
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <FS.h>
#include <SPIFFS.h>
AsyncWebServer server(80);
const char* ssid = "Michelii";
const char* password = "Barcello";
void conectarWiFi() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Conectando ao Wi-Fi...");
}
Serial.print("Endereço IP: ");
Serial.println(WiFi.localIP());
Serial.println("Conexão Wi-Fi estabelecida");
}
void setup() {
Serial.begin(115200);
conectarWiFi();
if(!SPIFFS.begin(true)){
Serial.println("Ocorreu um erro ao montar SPIFFS");
return;
}
server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(SPIFFS, "/index.html");
});
server.begin();
}
void loop() {
delay(1000);
Serial.println("Teste");
}
Code: Select all
<html>
<head>
<meta charset='utf-8'/>
</head>
<body>
<h1>
ESP32
</h1>
<p>
Hello my friends!
</p>
</body>
<html>