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

Codes not working while booting without absence of wifi internet

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = "YourAuthToken";


char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

BlynkTimer timer;
int led = 2;
int button = 3;

void repeat() {
if ((digitalRead(button)) == HIGH) {
digitalWrite(led, HIGH); }
else {
digitalWrite(led, LOW); }
}

void setup()
{
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(button, INPUT);
  timer.setInterval(1000L, repeat);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
  timer.run();
}

i need to continue that led & button code even if blynk not connected to server while booting.
my issue is to avoid stuck code while booting while not connected to wifi

This has been covered many times on the forum. A quick search would have revealed the solution.

You are using Blynk.begin, which is a blocking function. You need to handle the WiFi connection yourself, then use Blynk.config and Blynk.connect

Pete.

Could u correct my code as per ur idea and post it here please… will be great help for me…

Regards
Abin

I could, but I’m not going to.
You’ll learn much more by searching the forum for information about the issue and incorporating code examples into your own code.

Pete.

so sad…

If you took @PeteKnight’s advice and searched the forum, you would find that it has already been written for you.

While I am not inclined to write if for you either, I will throw you a bone and point you to an example.

I already solved by myself. Thanks… for your reply toro-blanco