Моє вітання!
Від системи blynk я в захваті.
Але по суті:
Не можу ніяк розібратись коли викликається функція BLYNK_READ(). Приклади і документацію читав, але все одно просвітлення не здобув.
От з функцією BLYNK_WRITE() наче все зрозуміло. Наприклад, на V0 висить (софтова) кнопка в застосунку blynk (віджет кнопки?). Коли я її натискаю, то на моєму залізі (ESP8266) виконується функція BLYNK_WRITE(V0) і там я виконую потрібні дії, наприклад перевіряю стан V0 і в залежності від стану вмикаю чи вимикаю світлодіод під’єднаний до esp8266.
А от коли, при яких умовах, буде викликатись функція BLYNK_READ(V0)??? Те що там має міститись нове значення для V0 - Blynk.virtualWrite(V0, newValue);, то я розумію, але для чого це використовується? В яких випадках це може знадобитись?

My greetings!
From the system blynk I’m delighted.
But in essence:
I can not figure out when the BLYNK_READ () function is called. Read and read the examples and documentation, but still did not get enlightenment.
This with the function BLYNK_WRITE () is as if everything is clear. For example, on V0 hanging (soft) button in the application blynk (button widget?). When I click on it, my BLYNK_WRITE (V0) function in my hardware (ESP8266) is performed and I perform the necessary actions, for example check the state of V0 and depending on the state I turn on or off the LED connected to esp8266.
But when, under what conditions, the BLYNK_READ (V0) function will be called ??? That there should be a new value for V0 - Blynk.virtualWrite (V0, newValue); then I understand, but why is it used? In what cases can this be needed?
Thank you.

I have never used BLYNK_READ() either and the docs aren’t clear on the purpose so perhaps @Dmitriy can enlighten us?

День добрий.

When you have this in your widget settings and app is open and active -

Initially it was designed in order to avoid Timers in your code. However, due to high load it creates on our servers we made it work only for “Active” apps (open and running state).

Maybe later it will not require open app.

1 Like

BLYNK_READ function is convenient when you think in terms of “pulling” data from device. Please check this article:


OK, I will chip in with my interpretation now :stuck_out_tongue:

BLYNK_READ() is when a Widget, typically a display of some sort & set with a reading frequency, “Reads from” the device whatever data the associated function contains/generates… usually happens whenever the frequency says. (BASICLY, NO TIMERS IN CODE REQUIRED - EDIT But only when App Active… hmm I didn’t know that one).

  // This command writes Arduino's uptime in seconds to Virtual Pin (V0) whenever it "asks" based on it's reading frequency 
  Blynk.virtualWrite(V0, millis() / 1000);

BLYNK_WRITE() is when a Widget, typically a controller of some sort, “Writes to” the device’s associated function, whatever data the widget’s state contains… usually happens whenever the state changes.

  // This command sends the Button Widget's state, as integer, to this function for processing whenever that state changes.

I guess that’s why I never use it as I PUSH everything and never use Frequency values.

I suppose there might be some use to it but I’m struggling to think of one.

Дякую, Дмитро!

Наче розвидняється :slight_smile:

Для перевірки.
Наприклад, я маю на V1 датчик ds18b20. В програмі ESP8266 з періодом в 5 хвилин данні з датчика відсилаються на сервер функцією Blynk.virtualWrite. Але коли я відкриваю додаток (стає активним), і віджет Display(V1) має частоту читання, наприклад 5 секунд, то данні з датчика будуть надходити кожні 5 секунд, якщо в програмі є функція BLYNK_READ (V1).
Правильно я зрозумів?

Thank you, Dmitry!

As if it was light :slight_smile:

To check
For example, I have a ds18b20 sensor on V1. In the ESP8266 program with a period of 5 minutes, the data from the sensor is sent to the server with the function Blynk.virtualWrite. But when I open the application (becomes active) and the Display (V1) widget has a reading frequency, for example 5 seconds, the data from the sensor will be received every 5 seconds if the program has the BLYNK_READ (V1) function.
Did I understand correctly?

@taburyak I was under the impression you use one or the other, PUSH or PULL, not both.

1 Like

Correct. However, you still need Blynk.virtualWrite inside BLYNK_READ. You just don’t need Timer to trigger BLYNK_READ and thus Blynk.virtualWrite.

1 Like

Basically, yes… but you would have to have two redundant functions, one for the read, one for the write… As @Costas said, pick one or the other method… Since you wouldn’t see the 5 minute reading unless the app was active, in which case you would then see the 5 second reading… so no reason for both.

EDIT - I type too slow… and don’t pay attention, so by the time I send an answer, someone else already has… I think I am definitely in PUSH mode :wink:

1 Like

Дякую всім за участь.

Здається я зрозумів.

@Gunner @Costas , я ще не використовував функцію BLYNK_READ в своїх проектах. Але в процесі навчання та ознайомлення з документацією в мене виникло питання, а для чого BLYNK_READ? Може знадобиться мені? Як виявилось, я не бачу необхідності цієї функції в своїх проектах :slight_smile: Може колись, як виникне така потреба…
Мабуть тему можна закрити?

Thank you all for participating.

I seem to understand.

@Gunner @Costas, I have not yet used the BLYNK_READ function in my projects. But in the process of learning and familiarity with the documentation I have a question, and why BLYNK_READ? Maybe need me As it turned out, I do not see the need for this feature in my projects :slight_smile: Maybe it’s time for this to happen …
Perhaps the topic can be closed?