How to read a vPin value

Dear Friends,
this is probably a dummy question but anyway I feel brave to ask it !
I have a Value Display widget attached in virtual pin 13.
For a particular project, I need to know what value this V13 has and I cannot think of a way to get it.
In this V13 I doing two types of value passing: local and via bridge from other hardware.
Please be noted that in my sketch I have not BLYNK_WRITE(V13), because when I want to sent something locally to my V13 I just did: Blynk.virtualWrite(V13, val and in case of bridge: bridge1.virtualWrite(V13, val2)

So what do you think?

Thanks and Best Regards
Mike Kranidis

could you pls provide the (correctly formatted) code you have so far?

In this case the code is quite complicated and will not help at all.
In my message I explain all it is need ( I think ) in order to have suggestions.

Thanks anyway

well, in that case, the way you describe it it should work. Blynk.virtualWrite(V13, val) will update V13 with val for the token/device that you use in your code and in your widget.
dito with bridge IF you have everything setup correctly THEN bridge1.virtualWrite(V13, val2) will update V13 with val2 for whatever device you’ve bridged to. The only error I can see you could make without seeing the code is that you have a different device set for V13 on the widget, then for the code. In that case it obviously won’t update.

yes mike, I use it to check if my MCU is online

void check() {
  Blynk.syncVirtual(V40); // the value widget to check ( V13 on your project )
}

BLYNK_WRITE(V40) // check CPU Master
{
  if (buttonState == 0) {
    value = param.asString(); // Master uptime
  } else {
    value = "00:00:00" ;
  }
}

//in setup 

timer.setInterval(5000L, check);

Please read again this. I have not problem to write the values BUT to read back…

my example is to read value !

void check() {
  Blynk.syncVirtual(V13); // the value widget to check
}

BLYNK_WRITE(V13) // read the value of V13
{
     value = param.asString(); 
}

//in setup 

timer.setInterval(5000L, check);

Yes I know my comment wasn’t for you obviously. So I need BLYNK_WRITE(V13) … That’s ok to me. Thanks

yes blynk.write, read too … don’t ask me why :smile:
ah ah

it is Blynk.syncVirtual(V13) who ask V13 to be reading and store the value in param

1 Like