Execute code if Blynk is not connected

Hello, good morning guys

I would appreciate if you could help me with this code, there will be some way this code works if you are not connected to Blynk and searched but nothing else and I have seen nothing else with esp8266 but I am using an Arduino R3 and a bluetooth module HC05


#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
char auth[] = "YourAuthToken";
SoftwareSerial SerialBLE(10, 11); // RX, TX


void led();

void setup() {
  Serial.begin(9600);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);
  Serial.println("Waiting for connections...");
}

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

void led() {
  digitalWrite(5, HIGH);
  delay(100);
  digitalWrite(5, LOW);
  delay(100);
}

some code is missing !

char ssid[] = "***********";
char pass[] = "*********************";
//etc...

Blynk.begin(auth, ssid, pass, server_ip, port);

But that would be if I used a Wi-Fi connection, but I’m using an Arduino and a Bluetooth module HC05

No habia visto un error en mi codigo


#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
char auth[] = "YourAuthToken";
SoftwareSerial SerialBLE(10, 11); // RX, TX


void led();

void setup() {
  Serial.begin(9600);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);
  Serial.println("Waiting for connections...");

  pinMode(5, OUTPUT);
}

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

void led() {
  digitalWrite(5, HIGH);
  delay(100);
  digitalWrite(5, LOW);
  delay(100);
}

I’m not familiar with Bluetooth myself but generally this would be sorted by handling the connection manually by replacing Blynk.begin(SerialBLE, auth); with Blynk.config somehow

But you do not have to start Blynk through that line

Blynk.begin(SerialBLE, auth);

On WiFi world, and I believe the flow for Bluetooth would be the same, you can manage the connection yourself and use Blynk.config(auth); instead of Blynk.begin more info here: Blynk.config

I can’t help you as I never used Bluetooth with blynk.
:wink: