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

How to update multiple pins via api?

hello!

how can i update multiple virtual pins with a single “get” request using the api?
can someone show me an example please?

thanks!

Hello. You can’t. This is not supported.

:slight_frown:

than how should i do instead?
(i know i can make lots of http requests one after another, but there is a “nicer” way to do?

i have a battery operated device, and instead of wake up and blynk.run time by time - which is quite time / battery consuming - i thought to just wake up and quickly send the values (ideally with a single http request), then go back to sleep.

I think, the most consuming part is the establishing of connection. Once it is opened it is not big deal to send multiple requests.

ok, than i will do with multiple requests. thanks anyway for the fast answer!

Não sei se é aconselhável a não fazer isso, mas pra mim é só como um a aprendizado, ainda tenho que saber se é seguro fazer isso mas você pode tentar é só uma ideia.

thanks, but i have to send the get request from the mcu, not pc (browser).

Assuming you are not using all 128 virtual pins all you need to do is set up a single virtual pin to write to multiple virtual pins in your sketch. Then the api is to a single virtual pin but the MCU takes care of the rest.

wow, sorry @Costas, but i do not understand what you mean. i even stopped the (loud) music and re-read your post, but still no luck…
:slight_smile:

BLYNK_WRITE(V127){
int masterPin = param.asInt();
if (masterPin == 1){
    // Blynk.virtualWrite(Vx, 1);  // choose which virtual pins to control HIGH ( 0 to 126)
  }
 else{
  // Blynk.virtualWrite(Vx, 0);  //choose which virtual pins to control LOW (0 to 126)
 }
}

hm, i think you misunderstand the problem.
i would like to update some values time by time in the app, but without using blynk.run
(because it is slow and you can’t know when the values were actually sent and when you can turn off the wifi)

instead of blynk.run + blynk.virtualwrite, i would like to send the values with blynk api: this way, i just have to turn on the wifi, make the http requests, and right after that, i can turn off the system. it is much faster.

but what you reccomend, with BLYNK_WRITE(V127){, it is possible to use only if blynk.run is enabled.

Didn’t realise you wanted to use the api in the MCU.

for battery operated device i would like to reduce the “online” time to a minimum.
actually, i’m in some similar situation like this:

I just did something similar with IFTTT. I have several buttons on pins (wether virtual or physical). Then I add a button to the Dash (say V26) and use a button on V26 with the Eventor widget to “If V26 is on, turn on V24, also turn on V25” etc. This way I can make an API call (in this case with Google Assistent voice command) to turn on several relays at once.

1 Like

is there any news on this? would be great to send multiple values at the same time. maybe with curl put (json).

in my example i wanna send 12bit pwm Values for 3 pins to drive a PCA9685 which is driving a RGB LED Strip

The official answer sounds straight forward. As is the alternate solutions, send multiple requests in a group or like @Lichtsignaal did it.

And as this topic is rather old, If you have further questions pertaining to a particular attempt of your own, please create a new current topic.