Problem cannot connect blynk from my owner server ```

#include <BlynkSimpleEsp32.h>

#define BLYNK_PRINT Serial
#define RELAY_PIN_1 32  // F1
#define RELAY_PIN_2 33  // F2
#define RELAY_PIN_3 25  // F4 - 3 second hold
#define RELAY_PIN_4 26  // RESET

#define RELAY_PIN_1 V10 // F1
#define RELAY_PIN_2 V11 // F2
#define RELAY_PIN_3 V12 // F4 - 3 second hold
#define RELAY_PIN_4 V13 // RESET


int wifiFlag = 0;

#define AUTH "*******************************m"   // Blynk token  
#define WIFI_SSID "******"    //MHE_FIRST             //Enter Wifi
#define WIFI_PASS "******"  //fi1958rst         //Enter wifi Password

#define wifiLed   23

BlynkTimer timer;
int pinValue = 0;

// Select your pin with physical button
const int btnPin1 = 21;  // FULL
const int btnPin2 = 19;  // MAX
const int btnPin3 = 5;   // MIN
const int btnPin4 = 16;  // F1  led
const int btnPin5 = 15;  // F2  led

WidgetLED led1(V1);   // full led
WidgetLED led2(V2);   // MAX  led
WidgetLED led3(V3);   // MIN  led
WidgetLED led4(V4);   // F1  led
WidgetLED led5(V5);   // F2  led

// LED Widget represents the physical button state
boolean btnState1 = false;
boolean btnState2 = false;
boolean btnState3 = false;
boolean btnState4 = false;
boolean btnState5 = false;

void checkBlynkStatus() {  // called every 3 seconds by SimpleTimer

  bool isconnected = Blynk.connected();
  
  if (isconnected == false) {
    wifiFlag = 0;
    digitalWrite(wifiLed, LOW); //Turn off WiFi LED
    Serial.println("WiFi Not Connected");
  }
  if (isconnected == true) {
    wifiFlag = 1;
    digitalWrite(wifiLed, HIGH); //Turn on WiFi LED
    Serial.println("WiFi Connected");
  }

  if (WiFi.status() != WL_CONNECTED) {
  bool status = WiFi.status();
  if ( status != WL_CONNECTED) {
    WiFi.reconnect();
    WiFi.begin(WIFI_SSID, WIFI_PASS);
    Serial.println("Try to Connect WiFi");

  // if your relay is HIGH triggering
  if (digitalRead(32) == 1) Blynk.virtualWrite(V10, digitalRead(32));
  else Blynk.syncVirtual(V10);

  if (digitalRead(33) == 1) Blynk.virtualWrite(V11, digitalRead(33));
  else Blynk.syncVirtual(V11);

  if (digitalRead(25) == 1) Blynk.virtualWrite(V12, digitalRead(25));
  else Blynk.syncVirtual(V12);

  if (digitalRead(26) == 1) Blynk.virtualWrite(V13, digitalRead(26));
  else Blynk.syncVirtual(V13);
  
  }
  }
}

void buttonLedWidget() {

  // Read button
  boolean isPressed_1 = (digitalRead(btnPin1) == LOW);  // FULL
  boolean isPressed_2 = (digitalRead(btnPin2) == LOW);  // MAX
  boolean isPressed_3 = (digitalRead(btnPin3) == LOW);  // MIN
  boolean isPressed_4 = (digitalRead(btnPin4) == LOW);  // F1  LED
  boolean isPressed_5 = (digitalRead(btnPin5) == LOW);  // F2  LED


  // If state has changed...
  if (isPressed_1 != btnState1) {
    if (isPressed_1) {
      led1.on();
    } else {
      led1.off();
    }
    btnState1 = isPressed_1;
  }
  if (isPressed_2 != btnState2) {
    if (isPressed_2) {
      led2.on();
    } else {
      led2.off();
    }
    btnState2 = isPressed_2;
  }
  if (isPressed_3 != btnState3) {
    if (isPressed_3) {
      led3.on();
    } else {
      led3.off();
    }
    btnState3 = isPressed_3;
  }
  if (isPressed_4 != btnState4) {
    if (isPressed_4) {
      led4.on();
    } else {
      led4.off();
    }
    btnState4 = isPressed_4;
  }
  if (isPressed_5 != btnState5) {
    if (isPressed_5) {
      led5.on();
    } else {
      led5.off();
    }
    btnState5 = isPressed_5;
  }
}

void setup() {

    // Debug console
    Serial.begin(115200);
    
    // relay
    pinMode(RELAY_PIN_1, OUTPUT);
    pinMode(RELAY_PIN_2, OUTPUT);
    pinMode(RELAY_PIN_3, OUTPUT);
    pinMode(RELAY_PIN_4, OUTPUT);
    digitalWrite(RELAY_PIN_1, HIGH); 
    digitalWrite(RELAY_PIN_2, HIGH);
    digitalWrite(RELAY_PIN_3, HIGH);
    digitalWrite(RELAY_PIN_4, HIGH);
    
    pinMode(wifiLed, OUTPUT);

    WiFi.mode(WIFI_STA);
    delay(200);
    
    WiFi.begin(WIFI_SSID, WIFI_PASS);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
  
  // Setup physical button pin (active low)
    pinMode(btnPin1, INPUT_PULLUP);
    pinMode(btnPin2, INPUT_PULLUP);
    pinMode(btnPin3, INPUT_PULLUP);
    pinMode(btnPin4, INPUT_PULLUP);
    pinMode(btnPin5, INPUT_PULLUP);

    timer.setInterval(2000L, checkBlynkStatus); // check if Blynk server is connected every 2 seconds
    timer.setInterval(500L, buttonLedWidget);
  
    Blynk.config(AUTH, "*************************", 17***);
}
    BLYNK_WRITE(V20) {
     pinValue = param.asInt();
  }

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

no working connect blynk my owner server

copy here:

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1448
load:0x40078000,len:14844
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c
ets Jul 29 2019 12:21:46

thank you for help

I assume that when you say “my own server” you mean a Blynk legacy local server?

If so then what version of the Blynk library and Blynk local server are you using?

Pete.

my onwer server blynk server 1.0

but I have one board all good work connect Blynk, and the second two boards it. I don’t understand… how is it?

Can’t help unless you answer my questions…

Pete.

blynk 1.0.0 and yes blynk local server Qnap.

You need to be using v0.6.1 of the Blynk library.
I’d expected an answer that began with v0.41.xx for your local server version.

I’d also try to avoid v3.x.x of the ESP32 core with this old Blynk library, and you may even need to go back to a fairly old version of the v2.xx.x core if you still have issues.

Can’t be more specific unless you can be more specific about your own setup.

Pete.

Thank you,
but I managed to find it. I know the reason…
best regards

Normal protocol would be for you to share that reason, so that others in the same position can learn from your experience.

Pete.

2 Likes