Serial Monitor Code for Wifi

Hi Good Morning Guys. I need help about how to write Serial Monitor Code for Wifi.

Compilation error: redefinition of 'void setup()' always like this

Hello, Felix. Please, post your sketch here between the </> code tags. This will help others answer your question.

#include <WiFi.h>

const char* ssid = "ssid";
const char* password = "pass";

void setup(){
    Serial.begin(115200);
    delay(1000);

    WiFi.begin(ssid, password);
    Serial.println("\nConnecting");

    while(WiFi.status() != WL_CONNECTED){
        Serial.print(".");
        delay(100);
    }

    Serial.println("\nConnected to the WiFi network");
    Serial.print("Local ESP32 IP: ");
    Serial.println(WiFi.localIP());
}

void loop(){
  
}

then after i run the code he keep connecting cant even connected the wifi

and cant print out the IP just keep connecting then ......................
What problem actually huh

Are the SSID and password correct?
Can you Serial.println( WiFi.status()) rather than the "."?
Do you need to set a WiFi.mode()?

Yep the ssid n password correct
i think no need to set a wifi.mode() maybe this is for what?

#include <WiFi.h>

const char* ssid = "ssid";
const char* password = "password";

void setup(){
    Serial.begin(115200);
    delay(1000);

    WiFi.begin(ssid, password);
    Serial.println("\nConnecting");

    while(WiFi.status() != WL_CONNECTED){
        Serial.print("WiFi.status()");
        delay(100);
    }

    Serial.println("\Connected to the WiFi network");
    Serial.print("Local ESP32 IP: ");
    Serial.println(WiFi.localIP());
}

void loop(){

}

its that like this wifi status?


still same

Don't think @xfpd meant to print out the text...

the value of WiFi.status()... remove the quotes (").

Try this... (without " quotation marks)

Serial.print(WiFi.status());

still cannot then i try my phone hotspot can. yeah i think is my company wifi got security block so i am fixing now

so it just ask to fix right

What was the output of Serial.print(Wifi.status());?

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