Hi,
I m using Platformio to upload a web server sketch example everything is ok but if I open the serial monitor to get the ESP IP address is not connecting to my Wifi
This is the code :#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
// Replace with your network credentials
const char* ssid = “REPLACE_WITH_YOUR_SSID”;
const char* password = “REPLACE_WITH_YOUR_PASSWORD”;
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
const char index_html[] PROGMEM = R”rawliteral(
<!DOCTYPE html>
<html>
<head>
<title>ESP Web Server</title>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”icon” href=”data:,”>
<style>
html {
font-family: Arial;
text-align: center;
}
body {
max-width: 400px;
margin:0px auto;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>Congratulations!<br>This is your first Web Server with the ESP.</p>
</body>
</html>
)rawliteral”;
void initWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print(“Connecting to WiFi ..”);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(‘.’);
delay(1000);
}
Serial.println(WiFi.localIP());
}
void setup() {
// Serial port for debugging purposes
Serial.begin(115200);
initWiFi();
server.on(“/”, HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, “text/html”, index_html);
});
// Start server
server.begin();
}
void loop() {
// put your main code here, to run repeatedly:
}
I need Help.
Hi.
Did you insert the right SSID and password on the cod before uploading it to your board?
Regards,
Sara
HI,
Thank you for your answer .
SSID is correct because I tray the same with IDE Arduino is Working but for Platformio the code is uploaded to the board with no problem then if I open the serial monitor only dot I restart the board but no connecting no IP Adresse
Thank you