Page 1 of 1

Cannot connect to my wifi network

Posted: Tue Dec 07, 2021 10:34 am
by tuadru
Hello everyone, not sure if this is right place to post this topic so Im sorry in advance if its not.
Im trying to use my esp32 to send some data into the database (I was previously using esp8266 for this but it has some issues with my i2c sensor so Im trying to switch to esp32). Im stuck at very first step, it cannot connect to my wifi network! Ive serched but there is no typo and it finds the network without problem with WiFiScan but once I try to connect to it, it doesent work. I can connect to same network with my esp8266 without any problems so Im wondering whats the issue here?

Code: Select all

#include <Arduino.h>
#include <WiFi.h>

void setup() {
  Serial.begin(115200);
  WiFi.begin("xxxxxxxxx", xxxxxxxx");
  

  // Wait for wifi to be connected
  uint32_t notConnectedCounter = 0;
  while (WiFi.status() != WL_CONNECTED) {
      delay(100);
      Serial.println("Wifi connecting...");
      notConnectedCounter++;
      if(notConnectedCounter > 150) { // Reset board if not connected after 5s
          Serial.println("Resetting due to Wifi not connecting...");
          ESP.restart();
      }
  }
  Serial.print("Wifi connected, IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // put your main code here, to run repeatedly:
}

Re: Cannot connect to my wifi network

Posted: Wed Dec 15, 2021 8:26 am
by tuadru
Still unable to resolve this issue.

Re: Cannot connect to my wifi network

Posted: Thu Dec 16, 2021 2:15 am
by ESP_Sprite
Suggest you look at existing examples first, see if those work for you. (And 5s is a very small timeout for a wifi connection... you may want to increase that regardless.)