#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.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";
WidgetBridge bridge1(V1);
WidgetBridge bridge2(V2);
WidgetBridge bridge3(V3);
WidgetBridge bridge4(V4);
WidgetBridge bridge5(V5);
WidgetBridge bridge6(V6);
void setup()
{
bridge1.virtualWrite(analogRead(36));
bridge2.virtualWrite(analogRead(39));
bridge3.virtualWrite(analogRead(34));
bridge4.virtualWrite(analogRead(35));
bridge5.virtualWrite(digitalRead(32));
bridge6.virtualWrite(digitalRead(33));
// Debug console
Serial.begin(9600);
}
BLYNK_CONNECTED() {
bridge1.setAuthToken("ljF4YLcyFN9P6iVeze92GsffvGwSeb2J");
}
void loop()
{
Blynk.run();
}
First of all , bridge1 is the transmitter so it’s not needed
you have to declare bridge2 to 6 they are receivers
like this
char BridgeAuth2[] = "fgfggfdggfdgdg";
char BridgeAuth3[] = "fgfggfdggfdgdg";
Bridge2.setAuthToken(BridgeAuth2);
Bridge3.setAuthToken(BridgeAuth3);
and so on
I want to communicate between two devices is code suitable for that
//before setup
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
char BridgeAuth2[] = "fgfggfdggfdgdg";
char BridgeAuth3[] = "fgfggfdggfdgdg";
BLYNK_CONNECTED() {
Bridge2.setAuthToken(BridgeAuth2);
Bridge3.setAuthToken(BridgeAuth3);
}
In your code there are more than 2 devices
Do you need to have 2 ways communication ? MCU1 <—> MCU2
no i want to send data from one esp32 to another esp32
So you only need bridge2 with the Auth of the ESP32 N°2
but the code is wrong
bridge1.virtualWrite(analogRead(36));
bridge2.virtualWrite(analogRead(39));
bridge3.virtualWrite(analogRead(34));
bridge4.virtualWrite(analogRead(35));
bridge5.virtualWrite(digitalRead(32));
bridge6.virtualWrite(digitalRead(33));
you have to put analogRead into variable
and send to ESP N°2 with this
bridge2.virtualWrite(Vpin, resultA36);
I need to send values of multiple analog pins from one esp32 to another its one way communication
Can you provide me an example please
in the first ESP32
int A36=analogRead(36);
bridge2.virtualWrite(Vpin, A36);// Vpin is the VirtualPin you need in the second ESP32
in the second ESP32
BLYNK_WRITE(Vpin) {//receiver same pin as the 1st ESP32
int A36= param.asInt();
}
ok let me do it i will be back if I face some issues thanks sir
Don’t forget that analog input should be less than 3.3V
can i use a voltage divider for that
You can use resistors and make a bridge
I use that with 5V sensors
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int A36=analogRead(36);
int A39=analogRead(39);
int A34=analogRead(34);
int A35=analogRead(35);
int A32=analogRead(32);
int A33=analogRead(33);
// 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";
BLYNK_CONNECTED(){
Bridge2.setAuthToken(ljF4YLcyFN9P6iVeze92GsffvGwSeb2J);
}
WidgetBridge bridge1(V1);
WidgetBridge bridge2(V2);
void setup()
{
bridge2.virtualWrite(V1, A36);
bridge2.virtualWrite(V2, A39);
bridge2.virtualWrite(V3, A34);
bridge2.virtualWrite(V4, A35);
bridge2.virtualWrite(V5, A32);
bridge2.virtualWrite(V6, A33);
// Debug console
Serial.begin(9600);
}
void loop()
{
Blynk.run();
}
its the second code it is showing an error
‘Bridge2’ was not declared in this scope
Please edit your post (using the pencil icon at the bottom) and add triple backticks at the top and bottom of your code.
Triple backticks look like this: ```
i edited it
bridge2.setAuthToken(ljF4YLcyFN9P6iVeze92GsffvGwSeb2J);// <-- wrong format
bridge2.setAuthToken(BridgeAuth2); // right format
->> bridge , not Bridge
You forgot to connect Blynk and your code to send analogRead is wrong
You have to read analog pin with timer function and send to bridge
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();