Esp32 wont connecet

i have found this code and it didnt work so i edited the blynk config and wifi tags at the bottom and still no connecetion. i look at the serial moniter but it just keeps trying to connecet to the wifi network with no success. when i run usb script it says everything is running except for DSR which is off, might not be helpfull but thats what is says. please help!


int pin        = 21;

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "GL_Nd7y_iGqeqZfJFyDMRd_L-VmJfSJk";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";

void setup() {  
  pinMode(pin, OUTPUT); 
  pinMode(pin, HIGH);
  Serial.begin(115200);

  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("WiFi connected");  

  Blynk.begin("xxx", ssid, pass);

}

void loop(){
    Blynk.config(auth);
    Blynk.connectWiFi(ssid, pass);
}


The USB script is only used when you have a device that has no Wi-Fi or Ethernet connection method. It is not used with an ESP32.

This probably means that your SSID or password are incorrect. Both are case sensitive.

Then we get on to the real issue!

If you are using Blynk.begin then you shouldn’t be doing the Wi-Fi connection process that precedes it.
If instead you want to use Blynk.config and Blynk.connect then these need to be in your void setup in place of Blynk.begin.

Either way, the only thing that should be in your void loop is:
Blynk.run()

Pete.

i have done all the revisions you stated but still there is no connecetion. i also made sure wifi ssid and password is correct and they are.

I’d suggest that you post your latest code and serial monitor output.

Pete.