How to compare value two value in blynk app

I am reading two sensor value by esp8266 and uploading on blynk app . I want to compare that value if the value is not same then I should get notification that value is not equal can it be possible please help me to figure it out.

Thanks

You should compare the values using code on your ESP8266 and when the desired condition is met then trigger a notification from the ESP8266.

Pete.

I am using 2 esp8266 from that I am uploading data to blynk so I am unable to compare in code

You can use the Blynk BRIDGE widget (look in the examples) so send the value from one ESP8266 to the other one. Then on the ESP8266 that has both values, do the comparison and determine the action.
billd

can i compare analog values?

Yes.
Although the signals sent to the ESPs may be analogue when they come from the sensors, the first thing that happens is that they are converted to digital values that the ESP can handle using the onboard ADC. This means that they will either be held as floating point or integer values, either of which can be compared in code.

Pete.

thanks sir

can you please provide any example code for this .

There’s an example in the SketchBuilder, but it’s not very intuitive:
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FBridge

But if you search this forum then there are some much better examples of how to use Bridge code.

Pete.

A description of the BRIDGE widget, how it works, and example code is on the Blynk Docs page. . .

There is also an example in the Blynk Examples folder in Arduino IDE . . .

Play around with the examples and see how you go . . .

billd

thanks sir,

sir i want to know that how many device we can connect through bridge.Like i have three device A,B and C i want to send data to A from B and C can will it be possible.

Yes, it’s possible. If you search the forum you’ll find at least one example of how to do this.

Pete.

hello

i have received value using blynk bridge in variable pinData and pinData1 now i want to compare value of this two variable like this
if(pinData+pinData1==data){ serial.println("it is equal");}else{Serial.println("not equal");}
so my question is where should i put the above code in my program below is my program
Capture

please help me to figure it out

thanks

I guess it depends on the timing of when you expect data to be sent from the two ‘slave’ devices.

One option is to put your comparison code in a function (called void compare-values() maybe?) and call this from both of your BLYNK_WRITE callback functions.

This way, when either of the values change the comparison will be done.

Pete.

Thanks pete its working

1 Like