Set up sketch for hourly request from Blynk

Hi everyone, I am building a project based on Arduino MKR GSM 1400 using Blynk as a dashboard.
I need to update values on the dashboard hourly but inside the sketch are planned some function that work every 10 minutes and other every 60 minutes. All function generate values which will be required by Blynk and shown on the dashboard.
I don’t understand if value required by Blynk must be inside void loop to be always available, is it?
Do I have to produce data in functions and than keep it in void loop to make them available “on demand” to Blynk?
Thank you

I really don’t understand what you’re asking here.
I think possibly that you might be running into issues with variable shope. If you declare a variable within a function then it’s value is only available within that function.

Your void loop should contain only two or three lines of code, and you should use BlynkTimer to call timed functions. Maybe reading this might help…

If not then maybe you need to give an example of what you’re struggling with.


Dear Pete,
effectively I haven’t understand how Blynk timer is working and my question was unclear for that.
Otherwise you suggest a really good guide and now I start to understand.
I tried some data uploading to Blynk and I figured out that if I want to send data once per hour I must set a timer for a routine hourly and use Blynk.virtualWrite inside it.
So I will send data only by virtual PIN and I don’t have to read analog or digital PIN from Blynk directly.
Is it ok or it will spam the cloud?

That’s fine. You won’t flood the cloud server unless you send data more than 10 times per second.