Esp32 web server and Web Client is not working

does anyone here knows how to solve this?
basically im trying to deploy a web server in my ESP32 DevKit V1
but as you can see in Serial Monitor it always spamming "..........." infinitely. according to one commen there the problem is incorrect SSID and Password but i even try to copy paste the entire code but it seems it is not working.(see code below)

i even tried to use the example code of wifi from File > Example > WiFi > WiFiClient but it also doesn't work. so i assume the Wifi.h has a problem but i could be wrong.(2)

however i tried to use another WiFi example code File>Example>WiFi> WiFi accesspoint and it works. idk what is the problem of the first code(3) idk why my first nd 2nd attempt doesnt work but this one is working

My board is ESP 32 DevKit V1 and the Board in my Arduino IDE is DOIT ESP32 DEVKIT V1

source code of my first attempt:

#include <WiFi.h>

// Replace with your network credentials
const char* ssid = "LeoUser";
const char* password = "pass123";

// Set web server port number to 80
WiFiServer server(80);

// Variable to store the HTTP request
String header;

// Auxiliar variables to store the current output state
String output26State = "off";
String output27State = "off";

// Assign output variables to GPIO pins
const int output26 = 26;
const int output27 = 27;

// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0; 
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;

void setup() {
  Serial.begin(115200);
  // Initialize the output variables as outputs
  pinMode(output26, OUTPUT);
  pinMode(output27, OUTPUT);
  // Set outputs to LOW
  digitalWrite(output26, LOW);
  digitalWrite(output27, LOW);

  // Connect to Wi-Fi network with SSID and password
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  // Print local IP address and start web server
  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  server.begin();
}

source:

might work a bit better.

  int TryCount = 0;
  while ( WiFi.status() != WL_CONNECTED )
  {
    TryCount++;
    WiFi.disconnect();
    WiFi.begin( SSID, PASSWORD );
    vTaskDelay( 4000 );
    if ( TryCount == 10 )
    {
      ESP.restart();
    }
  }```

tried using this. it does say
WiFi Connected
Ip Address:
0.0.0.0

but it also doesnt show WiFI connection on my Wifi list

The issue may not be ESP related. Especially if the ESP is getting that IP address.

is this Library issue?
my WiFiClient example code also doesnt work but the WiFiAccesspoint is working which is weird

@Idahowalker , do you want to wear out the flash? WiFi.begin stores the credentials to flash and disconnect clears them if persistence is on.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.