-
• #2
Sat 2021.09.11
Hi @Mrbbp has the example at been tried?
-
• #3
Sat 2021.09.11
Simple sample from above link:
var f = require("Storage"); f.write("a","Hello",0,14); f.write("a"," ",5); f.write("a","World!!!",6); print(f.read("a")); // "Hello World!!!"
Add a counter:var nCount = 0; nCount++; f.write("n",nCount.toString()); console.log("count is: ", f.read("n")); nCount++; nCount++; nCount++; f.write("n",nCount.toString()); console.log("count is: ", f.read("n")); console.log(f.read("a"));
Now, type
save()
archiving that code block to permanent storage.reset();
Reset device or power off / power on, then type in L-Hand console of WebIDE
console.log("count is: ", f.read("n")); console.log(f.read("a"));
Output:
count is: 4 Hello World!!! >
-
• #4
check Combining options
Hello,
I'm looking for to store a var in a permanent way (power off) and load at start (power on)
i saw that @Gordon implement a way to store data since 2v05, but the example code is for log datas (implementative way) and it seems a beat complex just for store a counter var.
have you a simple example to implement a counter (with a long type) storage over power-down?
I've tried
but it does not works!
what i'm doing wrong?
thanks for your time.