<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to save data without SD card?]]></title><description><![CDATA[<p dir="auto">What is recommended practice to save data without user having SD card? For example say you make a counter and want to save the last count. Since M5 can easily reset from a loose connection , it would be great to save the last count internally.</p>
<p dir="auto">In my rsearch i find it is possible to save to flash memory (?) but there are a limited amounts of read /writes. is this correct? I dont want to ruin my machine by having a counter take up all the one-time memory</p>
<p dir="auto">any tips?</p>
]]></description><link>https://community.m5stack.com/topic/150/how-to-save-data-without-sd-card</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 06:45:33 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/150.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Mar 2018 19:16:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to save data without SD card? on Fri, 06 Apr 2018 18:31:12 GMT]]></title><description><![CDATA[<p dir="auto">use "Preferences" class<br />
#include &lt;Preferences.h&gt;</p>
<p dir="auto">Preferences preferences;</p>
<p dir="auto">void setup() {<br />
Serial.begin(115200);<br />
Serial.println();</p>
<p dir="auto">// Open Preferences with my-app namespace. Each application module, library, etc<br />
// has to use a namespace name to prevent key name collisions. We will open storage in<br />
// RW-mode (second parameter has to be false).<br />
// Note: Namespace name is limited to 15 chars.<br />
preferences.begin("my-app", false);</p>
<p dir="auto">// Remove all preferences under the opened namespace<br />
<a href="//preferences.clear" target="_blank" rel="noopener noreferrer nofollow ugc">//preferences.clear</a>();</p>
<p dir="auto">// Or remove the counter key only<br />
<a href="//preferences.remove" target="_blank" rel="noopener noreferrer nofollow ugc">//preferences.remove</a>("counter");</p>
<p dir="auto">// Get the counter value, if the key does not exist, return a default value of 0<br />
// Note: Key name is limited to 15 chars.<br />
unsigned int counter = preferences.getUInt("counter", 0);</p>
<p dir="auto">// Increase counter by 1<br />
counter++;</p>
<p dir="auto">// Print the counter to Serial Monitor<br />
Serial.printf("Current counter value: %u\n", counter);</p>
<p dir="auto">// Store the counter to the Preferences<br />
preferences.putUInt("counter", counter);</p>
<p dir="auto">// Close the Preferences<br />
preferences.end();</p>
<p dir="auto">// Wait 10 seconds<br />
Serial.println("Restarting in 10 seconds...");<br />
delay(10000);</p>
<p dir="auto">// Restart ESP<br />
ESP.restart();<br />
}</p>
<p dir="auto">void loop() {}</p>
]]></description><link>https://community.m5stack.com/post/752</link><guid isPermaLink="true">https://community.m5stack.com/post/752</guid><dc:creator><![CDATA[X-Dron]]></dc:creator><pubDate>Fri, 06 Apr 2018 18:31:12 GMT</pubDate></item></channel></rss>