Internet Buttons support "retained variables"?

I can’t seem to get it to work…

I do the macro to enable the feature:
STARTUP(System.enableFeature(FEATURE_RETAINED_MEMORY));

Then declare the variable such as:
retained String status1 = “00000|0|–|”;

Then somewhere along the way, I do a System.reset(); It should retain the changed value of status1, no?

Thanks for any insight…

Tahl

How are you determining if the value is retained?

@kennethlimcp Sorry, put doing a published variable.

I cannot remember if string is supported.

You can using a char array and see if that works.

https://docs.particle.io/reference/firmware/electron/#storing-data-in-backup-ram-sram-

AFAIK String isn’t supported since the actual content of the object lives on the heap and not in the Backup SRAM area.

char[] is the way to go with that.

2 Likes

Thanks guys