BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

ESP32 hangs when booting without wifi (Blynk.begin ();)

esp32
#1

Help.
When I start the ESP32 with the WIFI network turned on, the program performs as correct.
The manual trigger only works when the network is switched off, when the network is switched on BLYNK automatically connects.

But if you start with the WIFI turned off, the program gets stuck, and does not even start LOOP ().
In other posts I realized that this happens because (Blynk.begin ():wink: tries to connect, and the LOOP is only going to work when ouver connect

Is there a way to make the program work without this failure?


#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

const int bt_anderson = 23;
const int led_manual = 19; 

char auth[] = "xxxxxxxx";
char ssid[] = "poixx";
char pass[] = "12345678";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  
pinMode (bt_anderson, INPUT_PULLUP); 
pinMode(led_manual, OUTPUT);   
}

void loop() {
Serial.println("LOOP ON");
while(true){
  if(Blynk.connected ()){
        Blynk.run();
        }else{
              Blynk.connect ();
              if(bt_anderson == 0){
                digitalWrite(led_manual, HIGH);
                }else{digitalWrite(led_manual, LOW);}
             }
   
  }
 }
}

0 Likes

#2

There a ton of examples in this forum, search for Blynk.config

1 Like

#3

really, but in none of them have I found the solution to this problem, it’s been a while since I’ve been searching here. But I need help.

0 Likes

#4

Really?

I tried to help but you didn’t listen.

By searching for Blynk.config I found:

2 Likes

#5

Calm.
Calm.
I know how to use basic Blynk.config () code, just connected in Wfi, but I always start the program without a Wifi network the program gets locked inside the SETUP (), as already said in the help request.
in this part that peciso helps.

0 Likes

#6

Did you have a look on my suggestion? If you did you would have noticed that you should replace:

By

  WiFi.begin(ssid, pass);  // Non-blocking if no WiFi available
  Blynk.config(auth);
  Blynk.connect();
0 Likes

#7

in case this example you mentioned is applicable to ESP32?
because when I did the search I searched for ESP32

0 Likes

#8

Should be applicable, have you tried?

1 Like

#9

Yes it is… and ESP8266, and Arduino with Ethernet, or something else with GSM…etc, and so on.

As per the Docs, it is basically a way of configuring Blynk independently of the connection method, and hardware, used.

http://docs.blynk.cc/#blynk-firmware-configuration-blynkconfig

0 Likes

#10

I had read the data on this link, but I could not understand it well.
because I have to translate, the translation comes out a bit confusing.
For a better understanding, the Blynk masters always help.

I edited the programming in ESP32, I will carry out the tests.

thank you so far.

0 Likes

#11

Any luck?

0 Likes

#13

With what? This OP’s particular issue… who knows :stuck_out_tongue_winking_eye:

Or with the overall solution? Which was already answered in the link above… but here it is again…

Just switch to Blynk.config() and additional connection management as needed

Here is an example for such, just adjust the libraries for ESP32

If you have any further questions, please create your own topic with full details, Thank you.

0 Likes