Change update frequency of a variable during runtime

Hi.

Is it possible to "change" a property during runtime (in my case, I'd like to change the update frequency).

As far as I understand the library implementation, ArduinoCloud.addProperty will do nothing if the property has already been added.

Is there any way to change the property?

Hi @asminator what type of property do you want to change during runtime ? What you are asking is not possible when using basic types like bool int or float, but should be possible using Cloud types like CloudFloat CloudInt ...

If in your thingProperties.h file there is something like this:

CloudFloat sensor;
...
ArduinoCloud.addProperty(sensor, READ, 1 * SECONDS, NULL);
....

then in your sketch you can use this method to change the update frequency:

sensor.publishEvery(unsigned long const seconds);

1 Like

Tanks a lot. I have Not been able to try it, but it looks exactly like the solution to my problem

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.