Also, if you’re just wanting to learn how Bridge works then I’d suggest sending something simple, like uptime in seconds, from one device to the other.
With gauge on receiving devices i’ve value ( on V44 and V43 ) from sender
Sending sketch :
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#define DHTPIN 2 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "IlcMe5hpdqwqpsoisIObIkhtNuRRq_k9";
char ssid[] = "indoor";
char pass[] = "indoorwifi";
BlynkTimer timer;
float h = dht.readHumidity();
float t = dht.readTemperature();
WidgetBridge bridge1(V1);
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, IPAddress(10, 3, 141, 1), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
BLYNK_CONNECTED() {
bridge1.setAuthToken("VsfeTTqiW4sizahXIBbECZSp0NohKEm_"); // Token of the hardware B
}
void loop()
{
Blynk.run();
timer.run();
}
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V20, h);
Blynk.virtualWrite(V21, t);
bridge1.virtualWrite(V43, t);
bridge1.virtualWrite(V44, h);
}
And if you read that post carefully you’ll see that it’s for a bi-directional Bridge, where both devices are both sending and receiving via the Bridge, which isn’t what you said you were trying to achieve.
Change this…
So that you’re serial printing the value that is being recieved on V43 rather than doing a Blynk.virtualWrite with it.
If you’re expecting this to do something with the data received on pin V44 then you’re mistaken…
That’s not how you access the data that is received on a virtual pin.
Read the “using virtual pins to control physical devices” tutorial that I linked to in post #14 for more info.
Wich can more can less, step by step, first one directional after bi directional. I don’t know how to change this
I receive two value humidity from V44 and temperature from V43 ineed both
I’s working with gauge attached to V44 and V33.
I don’t understand what you mean
as far as I know, when perform a virtualWrite with bridge, second board ( receiver ) will need to process the incoming command, It can be done by using this handler on the second board
BLYNK_WRITE(V5){
int pinData = param.asInt(); // pinData variable will store value that came via Bridge
// }
And I don’t know what this comment means, so it’s difficult to provide a sensible response.
There is no point in using Bridge on Legacy to send data to a gage widget. legacy allows the gauge widget to be attached to the datastream of the sending device, so bridge is redundant in that scenario.
What you are (I think) trying to achieve is to send temperature and humidity data from one device to another, so that the device which receives the data can apply some logical tests to it and take action - such as turning on a relay - if certain criteria are met.
The first step in achieving this is to visualise in the serial monitor of your receiving device the values that are being received. Note that I’ve said the serial monitor of the receiving device, NOT a widget in the Blynk app. So, you should put a serial print command inside the BLYNK_WRITE(vPin) commands that are being used to receive the data from te sending device.
Once you’ve proven that you are receiving the values that are being sent by the other device then you can write your logical test.
This should probably be done inside the BLYNK_WRITE(vPin) commands, or in a timed function which uses the values that have been received in the BLYNK_WRITE(vPin) commands. If you do the latter then you’ll need to use global variables.