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

I am writing a code for bridge communication

I can’t see any Bridge2 in your code
And as @PeteKnight said, you have to learn how blynk works before trying to send value with bridge
You have no connection , I don’t see any Blynk.connect();

@Yash69 please DO NOT create multiple logins to the forum.
Your @Yash68 login has been deleted and if you do this again your IP address and email will be blocked.

Pete.

2 Likes

I didn’t even notice :joy::joy:
And I can’t write his code, he has to learn before .

1 Like

You can search for such you know :wink:

1 Like
#define BLYNK_PRINT Serial



#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "qmppE8kZmNhF8zTuaQdi__QnmIL-Dw1u";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
char BridgeAuth2[] = "ljF4YLcyFN9P6iVeze92GsffvGwSeb2J";




SimpleTimer timer;

        
     WidgetBridge bridge1(V1);
     WidgetBridge bridge2(V2);
    


void setup(){
   Blynk.begin(auth, ssid, pass);
   while (Blynk.connect() == false) {
       
   }
   
   
 int A36 = analogRead(36);
 int A39 = analogRead(39);
 int A34 = analogRead(34);
 int A35 = analogRead(35);
 int A32 = digitalRead(32);
 int A33 = digitalRead(33);

 bridge2.virtualWrite(V1, A36);
   timer.setInterval(10);
 bridge2.virtualWrite(V2, A39);
   timer.setInterval(12);
 bridge2.virtualWrite(V3, A34);
   timer.setInterval(14);
 bridge2.virtualWrite(V4, A35);
   timer.setInterval(16);
 bridge2.virtualWrite(V5, A32);
   timer.setInterval(18);
 bridge2.virtualWrite(V6, A33);
   timer.setInterval(20);
}
BLYNK_CONNECTED() {
 bridge2.setAuthToken("BridgeAuth2"); // Token of the hardware B
}



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

I am trying to read analog pins with timer function it is showing an error

redefinition of ‘class BlynkTimer’

You should write BlynkTimer timer;

take a look at @PeteKnight topic.

is there anything else wrong in this code? xd

I don’t see any timer.setInterval

read @PeteKnight topic before continue

I read the post and modified the code but it is still showing an error

here is the code

#define BLYNK_PRINT Serial



#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Blynk.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "qmppE8kZmNhF8zTuaQdi__QnmIL-Dw1u";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
char BridgeAuth2[] = "ljF4YLcyFN9P6iVeze92GsffvGwSeb2J";




 BlynkTimer timer;
 
         
      WidgetBridge bridge1(V1);
      WidgetBridge bridge2(V2);
     


void setup(){
    Blynk.begin(auth, ssid, pass);
    while (Blynk.connect() == false) {
        
    }
    
    
  int A36 = analogRead(36);
  int A39 = analogRead(39);
  int A34 = analogRead(34);
  int A35 = analogRead(35);
  int A32 = digitalRead(32);
  int A33 = digitalRead(33);

  bridge2.virtualWrite(V1, A36);
    timer.setInterval(10);
  bridge2.virtualWrite(V2, A39);
    timer.setInterval(12);
  bridge2.virtualWrite(V3, A34);
    timer.setInterval(14);
  bridge2.virtualWrite(V4, A35);
    timer.setInterval(16);
  bridge2.virtualWrite(V5, A32);
    timer.setInterval(18);
  bridge2.virtualWrite(V6, A33);
    timer.setInterval(20);
}
BLYNK_CONNECTED() {
  bridge2.setAuthToken("BridgeAuth2"); // Token of the hardware B
}



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

and here is the error

‘Timer’ does not name a type

You have to learn guy :stuck_out_tongue_winking_eye:

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Blynk.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "qmppE8kZmNhF8zTuaQdi__QnmIL-Dw1u";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
char BridgeAuth2[] = "ljF4YLcyFN9P6iVeze92GsffvGwSeb2J";

BlynkTimer timer;

WidgetBridge bridge1(V1);
WidgetBridge bridge2(V2);

void setup() {
  Blynk.begin(auth, ssid, pass);
  
  while (Blynk.connect() == false) {
  }
timer.setInterval(1000L, Reading);
}

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

void Reading(){
  int A36 = analogRead(36);
  int A39 = analogRead(39);
  int A34 = analogRead(34);
  int A35 = analogRead(35);
  int A32 = digitalRead(32);
  int A33 = digitalRead(33);

  bridge2.virtualWrite(V1, A36);
  bridge2.virtualWrite(V2, A39);
  bridge2.virtualWrite(V3, A34);
  bridge2.virtualWrite(V4, A35);
  bridge2.virtualWrite(V5, A32);
  bridge2.virtualWrite(V6, A33);
}

BLYNK_CONNECTED() {
  bridge2.setAuthToken("BridgeAuth2"); // Token of the hardware B
}

can I lower the delay? :face_with_raised_eyebrow:
to 100ms

Hmm, where to begin?

I’m guessing that you don’t understand the basics of a C++ program structure, and that the void setup() function runs just once, at start-up.?

You’re also using the Blynk.connect() command, and I guess you really mean Blynk.connected(), although that whole piece of code is unnecessary anyway.

If you bother to read the link to my “Using BlynkTimer…” post then you’ll also realise that the syntax of theses commands is wrong…

You’d really be better scrapping your existing code and starting with this code on your “sending” device, and simply adding-in more commands into the void blynkAnotherDevice() function to send data to other virtual pins via the bridge…

Pete.

1 Like

yep I don’t understand c++ yet
I am starting to learn it :sweat_smile:

You can try.
what is analyzed? is 100ms really necessary?

Yes 100 ms is needed

I need answer : what is analyzed?

joysticks output to control something

1 Like

So, you’re using hardware joysticks connected to an ESP32, rather than joystick widgets in the app?
Which is why you need to use Bridge code.

Good luck with getting a responsive result with that setup!

BTW, did you know that the version of Blynk that you are currently using will be switched-off in 6 months or so?

Pete.

1 Like

idk how to use blynk new version and i want to control my devices even when i do not have my phone its the reason for choosing bridge :relaxed: when this blynk shut down then i will switch to the blynk iot :nerd_face:

hey can I use
int pindata = param.asmap
instead of int pindata = param.asint:thinking: