Cannot connect to my wifi network

tuadru
Posts: 6
Joined: Tue Dec 07, 2021 10:29 am

Cannot connect to my wifi network

Postby tuadru » Tue Dec 07, 2021 10:34 am

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:
}

tuadru
Posts: 6
Joined: Tue Dec 07, 2021 10:29 am

Re: Cannot connect to my wifi network

Postby tuadru » Wed Dec 15, 2021 8:26 am

Still unable to resolve this issue.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Cannot connect to my wifi network

Postby ESP_Sprite » Thu Dec 16, 2021 2:15 am

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.)

Who is online

Users browsing this forum: No registered users and 66 guests