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

BLYNK_WRITE non Change data

I am writing to you because I have a problem with BLYNK_WRITE.
I would like to receive data from a remote device (Wemos 8266) on arduino Mega Ethernet, I am using the following function:

BLYNK_WRITE (V15) {
xxxxx = param.asInt();
Serial.print("V15 pulsante ");
Serial.println(XXXX);
}
As you can see on my program, I have two Virtual Pins to detect, one is a V15 button, the other (V44) is a float datum that corresponds to a consumption reading in Watts.
If I change the state of the V15 button on the Mega device I detect the change of state, The ‘Button’ variable is updated. Each time you press the Blynk app, the status changes.

Instead the V44 when I start the program on Mega the data is read the first time, then, when the ‘Watt’ value changes, it is no longer updated.

I hope I have been clear and that my problem is understood. I read several posts on the subject but found no answer.
Thank you

• Arduino Mega with Ethernet Shield ENC28J60
• Smartphone IOS
• Blynk Library version 0.5.4

#define BLYNK_PRINT Serial
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
char auth[] = "xxxxxxxxx";
float Wat=1;
float Pulsante;

BLYNK_WRITE (V44)  {                                         
     Wat = param.asInt();
     Serial.print("V44 Watt : ");
     Serial.println(Wat);    
      }  
       
BLYNK_WRITE (V15)  {                                        
     Pulsante = param.asInt();
     Serial.print("V15 pulsante : ");
     Serial.println(Pulsante);    
      } 
        
BLYNK_CONNECTED()   {                
      Blynk.syncAll(); 
      Blynk.syncVirtual(V44,V15);
      }
        
void setup() {
     Serial.begin(9600);
     Ethernet.init(16); 
     Blynk.begin(auth);
     }

void loop() {
     Blynk.run();
     delay(1000);
     }
07:30:27.546 -> [0] Getting IP...
07:30:32.762 -> [5199] IP:192.168.1.29
07:30:32.762 -> [5199] 
07:30:32.797 ->     ___  __          __
07:30:32.797 ->    / _ )/ /_ _____  / /__
07:30:32.832 ->   / _  / / // / _ \/  '_/
07:30:32.866 ->  /____/_/\_, /_//_/_/\_\
07:30:32.901 ->         /___/ v0.5.4 on Arduino Mega
07:30:32.936 -> 
07:30:32.936 -> [5317] Connecting to blynk-cloud.com:80
07:30:33.821 -> [6203] Ready (ping: 70ms).
07:30:34.004 -> V15 pulsante 0.00
07:30:34.004 -> V44 Slider value is: 110.00
07:30:34.038 -> V44 Slider value is: 110.00
07:30:36.151 -> V44 Slider value is: 110.00
07:30:36.151 -> V15 pulsante 0.00
07:30:39.244 -> V15 pulsante 1.00
07:30:42.324 -> V15 pulsante 0.00
07:30:44.391 -> V15 pulsante 1.00
07:30:50.556 -> V15 pulsante 0.00
07:30:50.556 -> V15 pulsante 1.00
07:30:52.626 -> V15 pulsante 0.00
07:30:58.796 -> V15 pulsante 1.00
07:31:00.858 -> V15 pulsante 0.00

Updating to the latest Blynk library version (0.6.1) is the first thing you should do.

You should aso remove this delay from your void loop, it serves no purpose and will cause lots of problems in the future.

Pete.

Thanks for the reply, I have updated the new version of Blynk, I have removed the delay (1000); as you can see the result does not change, if I press the button on the Blynk app the virtual pin V15 is updated, the virtual Pin V44 is not read.

11:56:25.032 -> [5198] IP:192.168.1.29
11:56:25.032 -> [5199] 
11:56:25.069 ->     ___  __          __
11:56:25.069 ->    / _ )/ /_ _____  / /__
11:56:25.106 ->   / _  / / // / _ \/  '_/
11:56:25.143 ->  /____/_/\_, /_//_/_/\_\
11:56:25.180 ->         /___/ v0.6.1 on Arduino Mega
11:56:25.214 -> 
11:56:25.214 -> [5317] Connecting to blynk-cloud.com:80
11:56:30.207 -> [10317] Connecting to blynk-cloud.com:80
11:56:30.872 -> [10946] Ready (ping: 70ms).
11:56:31.079 -> V44 Watts: 2712.00
11:56:31.079 -> V15 pulsante 0.00
11:56:31.118 -> V44 Watts: 2712.00
11:56:31.186 -> V15 pulsante 0.00
11:56:35.054 -> V15 pulsante 1.00
11:56:37.053 -> V15 pulsante 0.00
11:56:38.256 -> V15 pulsante 1.00
11:56:40.024 -> V15 pulsante 0.00
11:56:42.078 -> V15 pulsante 1.00
11:56:43.618 -> V15 pulsante 0.00
11:56:45.507 -> V15 pulsante 1.00
11:56:47.230 -> V15 pulsante 0.00
11:56:49.024 -> V15 pulsante 1.00

What bridge code are you using?

Hi daveblynk, device A (wemos 8266 wifi) has the same code (char auth[] = “…”:wink: than device B (arduino Mega Ethernet).

I have to read the Virtual pins with device B from device A, some time ago I did some tests and it worked, now I don’t understand why it only reads the Virtual Pin V15 (float 1 or 0) and not the Virtual Pin V44 (float data varies from 0 to 0 to 4000).

In opzione conosco la funzione Bridge, ma prima di utilizzarla, vorrei capire perchè non funziona con il semplice “BLYNK_WRITE” .

You aren’t supposed to use the same Auth code on multiple devices.
Each device should have its own Auth code and you should use Bridge code to update one from the other (and vice versa if needed).

Pete.