Need to do simple statistics in Blynk. How?

Have you read the documentation?


1 Like

I did read, yes. But some parts of the documentation and Webhook widget naming/hints threw me off.

  • Widget/OUTPUT: I can put here any virtual pin; even a virtual pin which doesn’t get updated. For example: I put here V12, but my Arduino device never writes anything to V12, and yet webhook gets triggered. Also, this V12 value isn’t sent anywhere, even though the name “output” suggests to me it does.

  • Widget/URL: For example in case of Thingspeak I would write here …&field1=/pin[0]/&field2=/pin[1]/… and so on. But pin[0] actually refers to virtual in V1 and so on, and not to V0 as the name seems to suggest.

But I think I have understood it now and I can attack the real problem which is how to send data to external mySQL database. I’m able to send text to mySQL. But have not been successful yet to send value stored in virtual pin.

Now I can write from Blynk cloud to external mySQL database. I have to write to webhook body in this “format”:


Any advice on how I can write back from external mySQL toBlynk cloud?

@tipo1000 perhaps study the mySQL API and then do a regular GET call in the Webhook. So you are using cloud to read what is in the database rather than writing something to the cloud. Not quite sure why you would want to send data to the database and then read it back though.

  1. I need to read data from Blynk to mySQL
  2. Run some computation/statistics in mySQL
  3. Write computed data back to Blynk to some virtualPins.

1 and 2 are now working.
Still trying to figure out how to do 3).

Ok but I look at it as READING from db not WRITING to Blynk. mySQL API and webhook GET should sort you out for 3).

Writing to Blynk from mySQL was easy. Went exactly like in Blynk API doc.
I just put “” to php-file.

1 Like