Blynk Functionality

Hello Community!
How do you add widget reading frequency in the new android blynk app?

You can use a timer.

You don’t, you use a BlynkTimer in the sketch instead

Pete.

Thanks John and Pete.
I have included Simple Timer library in the sketch. Still doesn’t work

Another approch (if this was your intention).

I have in one device a possibility to set the polling, or reading, frequency of a Sensor with the mobile app.
I use a SLIDER to set a value which the Device gets/reads and sets the polling frequency accordingly. (Which is implemented by the use of timer in device.)

Necessary? No, not really. More of a test. But it works.

A more realistic idea would maybe (?) be to set the reading-frequency value as metadata for each individual device. This would then let the end User (if having access to the web interface) posdibility to configure each individual device to the wanted reading frequency.

If this was your intention.

First of all, you’re better off using BlynkTimer because it’s already included in the Blynk libraries.

Secondly, you have to initialise a timer object, then service that object in the void loop.

You then have to initialise a timer in void setup, specifying how often it will run (in milliseconds) and which function it will call when it does run.

Finally, the code you want to execute on a regular basis needs to go in the function that the timer is calling.

If you take a look at the Sketch Builder examples you’ll see many examples of how to use timers to do things like taking readings from a DHT sensor and send those readings to Blynk.

Pete.

Thanks Jonas,
My intention is to receive sensors values that change the color of the virtualPins in the app when high and low.

This seems like what i really should do. Thanks Pete

I think Pete’s reply is more appropriate.

Use of timer example: Blynk Example Browser

Yes, and I think this will be helpful :

1 Like

The metadata can be handy in some cases also you can use API to get or update the metadata as well.

1 Like

Thank you again John93, Jonas, Pete!
I was able to make the connection successful and i can see my data being transferred from my sensors, to Arduino Uno, and NodeMcu through their respective serial monitors. But i would love my Blynk Virtual Pin to change color when it receives a low(0), and have no color change when the received value is a high(255). I would really appreciate resources and guidance on how to achieve this
It is on the same topic so i though i can write my question here.

Would you like to change the button widget color or LED widget color ?

LED Widget color

Read the Blynk.setProperty documentation.

Pete.

1 Like

https://docs.blynk.io/en/blynk.edgent/mainoperations/widget-properties

1 Like