本帖最后由 inevitab 于 2024-4-23 16:50 编辑
我想存储一个变量,或者某个传感器获取到的数据,开发板断电再通电后,仍然能读取到上一次的数据
-----------------------------------------------
谢谢大家指导,已经解决,红色是关键代码
<div><div style="color: #000000;background-color: #fffffe;font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono','Courier New',monospace, Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #000099;">esp8266</span><span style="color: #000000;">:</span></div><div><span style="color: #000000;"> </span><span style="color: #000099;">board</span><span style="color: #000000;">: </span><span style="color: #0451a5;">esp01_1m</span></div><div><span style="color: #000000;"> </span><font color="#ff0000">restore_from_flash: true</font></div>
<div><span style="color: #000099;">preferences</span><span style="color: #000000;">:</span></div><div><span style="color: #000000;"> </span><font color="#ff0000">flash_write_interval: 2s</font></div><div><span style="color: #0451a5;">
</span></div></div></div><div><div style="color: #000000;background-color: #fffffe;font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono','Courier New',monospace, Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #000099;">globals</span><span style="color: #000000;">:</span></div><div><span style="color: #000000;"> - </span><span style="color: #000099;">id</span><span style="color: #000000;">: </span><span style="color: #0451a5;">my_global_value</span></div><div><span style="color: #000000;"> </span><span style="color: #000099;">type</span><span style="color: #000000;">: </span><span style="color: #0451a5;">float</span></div><div><span style="color: #000000;"> </span><font color="#ff0000">restore_value: true</font></div><div><span style="color: #000000;"> </span><span style="color: #000099;">initial_value</span><span style="color: #000000;">: </span><span style="color: #0451a5;">'0'</span></div></div></div>
|