Network Connection Issue

I am developing on an ESP32 using the Arduino_ConnectionHandler library to connect to a mobile phone hotspot, but it cannot connect, and the error code is 6. What is going on?

Hello

Is your phone hotspot set to the 2.4 GHz band or the 5 GHz band?

If you try this, what do you see ?


#include <WiFi.h>

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

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

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

  Serial.println();
  Serial.print("IP: ");
  Serial.println(WiFi.localIP());
}

void loop() {
}


Side note - please, please don’t post pictures of text... Not only they are difficult to read on small screens nor usable directly for copy&paste but they use up more storage and internet bandwidth than text which contributes to polluting the planet more than necessary.

➜ do your part and do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

When you googled status 254 and 6, what does it say?

typedef enum {
  WL_NO_SHIELD = 255,  // for compatibility with WiFi Shield library
  WL_STOPPED = 254,
  WL_IDLE_STATUS = 0,
  WL_NO_SSID_AVAIL = 1,
  WL_SCAN_COMPLETED = 2,
  WL_CONNECTED = 3,
  WL_CONNECT_FAILED = 4,
  WL_CONNECTION_LOST = 5,
  WL_DISCONNECTED = 6
} wl_status_t;

You may make quicker progress by grabbing the examplew code that matches what you are doing and eithedr modify it for you or compare to see what is different.
Until you post all the code we are all guessing.
Some phones can be a problem, in order to vet the code, connect to your router first then if/when it works, just change the creds. If that doesn;t work the issue is phone related.

What phone?