Persist Object

Top  Previous  Next

Allows you to save values in permanent (non-volatile) memory.

Description

The Persist object allows you to save values in permanent (non-volatile) memory. These values are available to any running script and are retained across device reset and power cycle. The Persist object cannot store strings, arrays, or objects. The memory used is limited in size and shared with other uses; you should expect the Persist object to be limited to less than 100 values. The member names of the Persist object are limited to 10 characters.

 

You access values in the Persist object using the member reference operators . and []. To create a new member, simply assign it a value, as shown in the examples. Referencing a member that does not exist creates a new member with that name, initialized to undefined. Assigning undefined to an existing member deletes it from the object and recovers the memory it was using.

Examples

// Remember serial port & baud rate

Persist.PLMbaud = 115200;

Persist.PLMport = 0;

// Recall and set serial port

Cell.Serial[Persist.PLMport] = Persist.PLMbaud;