m1cr0lab-esp32 / remote-control-with-websocket

ESP32 Remote Control with WebSocket
MIT License
37 stars 20 forks source link

Doesn't connect #1

Open fredwhitridge opened 4 years ago

fredwhitridge commented 4 years ago

Excellent clear tutorial. Just switched over to platformio and was able to get all the libraries. Project compiles and uploads but I don't seem to connect.

Added this code: Serial.println("Connecting.. status: " + String(WiFi.status())); delay(500); /status codes WL_NO_SHIELD = 255, // for compatibility with WiFi Shield library 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 / But it immediately goes to status 1 despite the fact that a scanner program on my AdaFruit Feather Huzzah32 finds the SSID I am trying to connect with. Have tried it in other buildings with other networks, always changing the SSID in the code and recompiling. Perhaps my problem is I'm currently trying to connect to an open network with no password? I'm using:

// WiFi credentials const char WIFISSID = "dd-wrt#6"; const char WIFI_PASS = "NULL";

Thanks in advance from this newbie

fredwhitridge commented 4 years ago

Trying a different router with a different SSID and password (both updated in code), I go directly to WL_DISCONNECTED = 6

m1cr0lab commented 4 years ago

Hey Fred,

Thank you for your positive feedback. And I'm sorry it took me so long to get back to you. I've been really busy this week.

Just try this:

// In case your ESP was in WIFI_AP mode
// WiFi.mode(WIFI_STA);
// WiFi.disconnect();
// delay(100);

WiFi.begin(WIFI_SSID); // no password
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
      Serial.print(".");
      delay(500);
}
Serial.println(WiFi.localIP());
edmonf commented 4 years ago

Nice and clean explanation, very helpful tutorial, sometime my wifi router slow to detect a client so must have much delay from your code, in mine delay(1000); or more

m1cr0lab commented 4 years ago

Thank you, Ed, for your positive feedback. Glad you found this tutorial helpful. And sorry for my late response.

passad commented 2 years ago

Hi Steph! Great tutorial, I've followed all the steps and it worked nicely! I have a point to comment/ask: I can only access the web server on Esp32 while on the same wifi network. Is it there any way to access it from a general ISP? I tried using NGROK tunneling. It works as long you have a pc logged in to the ngrok application.

Thanks!!