blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.84k stars 1.39k forks source link

Add examples for Virtual Pins #202

Closed blynkkk closed 7 years ago

blynkkk commented 7 years ago

Please create examples for BLYNK_WRITE BLYNK_READ Blynk.virtualWrite

Sketch names should be named VirtualPins_smth

It can be a single example skecth named Virtual Pins

You may also include alternatives for BLYNK_WRITE and BLYNK_READ

doom369 commented 7 years ago

@blynkkk we have such examples already.

https://github.com/blynkkk/blynk-library/tree/master/examples/GettingStarted/GetData https://github.com/blynkkk/blynk-library/tree/master/examples/GettingStarted/PushData https://github.com/blynkkk/blynk-library/tree/master/examples/GettingStarted/PushDataOnRequest

vshymanskyy commented 7 years ago

@blynkkk should we just rename them?

doom369 commented 7 years ago

@vshymanskyy if you choose renaming - please rename docs accordingly.

idesignstuff commented 7 years ago

This virtual pin concept could use more explanation for us noobs. I have fundamental questions about how we can use them. For instance, is the concept basically a variable that exists in 3 places at once: on the device, on the server, and in the app? Can I change the value of a virtual pin from any of those? I'd like to be able to both change the state of a vpin and see its current state on the app. Do I need to separate them? Should I have v5 do the state change on the device, say d5? Then v15 sends the state report to the app? This would be helpful to have explained in an example. Thanks very much for blynk!

doom369 commented 7 years ago

is the concept basically a variable that exists in 3 places at once: on the device, on the server, and in the app?

Yes.

Can I change the value of a virtual pin from any of those?

Yes.

I'd like to be able to both change the state of a vpin and see its current state on the app. Do I need to separate them?

No.

Should I have v5 do the state change on the device, say d5? Then v15 sends the state report to the app?

It depends on your needs. You can do both.

Here is docs with explanation - http://docs.blynk.cc/#blynk-main-operations

idesignstuff commented 7 years ago

Thanks for the response. Maybe it's just the wording on the documentation. It may be helpful to say "a virtual pin" instead of "virtual pins." Also, an example using a single pin to get data, act on it, and send data back to the app would be super helpful!

vshymanskyy commented 7 years ago

Same as #276