Blynk virtual pin

Hi everyone,
i have a small question

i use the Blynk app to control my Photon.
i want to write on a virtual pin.
it works well when i write it like this
Blynk.virtualWrite(V2, “write an example on virtual pin number 2”);
but i don’t understand how i can write to the pin data.

for example, let say i have an integer “n” which i want to write to the virtual pin.
i tried to write it like this
Blynk.virtualWrite(V2, n);
but it doesn’t work
in anyway i try, the app just stops working.

how can i do it?

thanks for the help

Hi, please read this:

http://docs.blynk.cc/#blynk-main-operations-get-data-from-hardware

Most likely your Photon is causing Flood of messages on our server. Here you can read about it: http://docs.blynk.cc/#blynk-main-operations-limitations-and-recommendations

There are 2 ways to avoid it, depending on what you need.

  1. If you need to get data from hardware only when you use your app - use this. For example to check what’s the temperature right now.
  2. If you need hardware to constantly push data even if the app is offline. For example you need to log the temperature - you would need to use some timer library to make timed events (e.g. send data every min). I use SPARKCOREPOLLEDTIMER library for that.

There is an example for Arduino, but SPARKCOREPOLLEDTIMER works very similar.

1 Like