Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
The slave board used by the robotic arm loses data after power-off. To save certain data and prevent it from being lost during power off, you can write this data into a file and store it in the Flash file system. Simply write the file to Flash before power-off, ensuring the file remains intact after power is restored, and then read the file upon powering up.
The JSON commands in this chapter are designed for manipulating files stored in the ESP32 FLASH, including scanning files, creating new files, editing file content, and reading file content. Files are retained even after power-off. If you re-upload the demo to RoArm-M2-S, you can also choose to save Flash files in the Arduino IDE.
{"T":200}
The returned data is shown below:
>>>---=== File Name and First line ===---<<<
[file]: [boot.mission]
[first line]:
{"name":"boot","intro":"these cmds run automatically at boot."}
>>>---=== File Name and First line ===---<<<
[file]: [mission_a.mission]
[first line]:
{"name":"mission_a","intro":"test mission created in flash."}
>>>---=== File Name and First line ===---<<<
[file]: [wifiConfig.json]
[first line]:
{"wifi_mode_on_boot":3,"sta_ssid":"JSBZY-2.4G","sta_password":"waveshare0755","ap_ssid":"RoArm-M2","ap_password":"12345678"}
The returned values include the file name of each file folder and the first line of contents. This file folder will display the full file name. If you create a new file with a suffix, it will be displayed too. Files with the suffix .mission are mission files, which can store some commands for batch operation of the robotic arm.
{"T":201,"name":"file.txt","content":"inputContentHere."}
{"T":202,"name":"mission_a.mission"}
The return content is as follows, the return content will be labeled out the line number (the following is an example, it does not mean that you will have the file mission_a.mission in your RoArm-M2):
{"T":202,"name":"mission_a.mission"}
---=== '''File Content '''===---
reading file: [mission_a.mission] starts:
[lineNum: 1 ] - {"name":"mission_a","intro":"test mission created in flash."}
[lineNum: 2 ] - {"T":104,"x":235,"y":0,"z":234,"t":3.14,"spd":0.25}
[lineNum: 3 ] - {"T":104,"x":104.3172406,"y":-112.6415887,"z":65.13450799,"t":2.448233337,"spd":0.25}
[lineNum: 4 ] - {"T":114,"led":155}
[lineNum: 5 ] - {"T":104,"x":-163.7763876,"y":-138.2353466,"z":105.0922663,"t":2.466641107,"spd":0.5}
[lineNum: 6 ] - {"T":114,"led":0}
[lineNum: 7 ] - {"T":114,"led":255}
[lineNum: 8 ] - {"T":104,"x":156.428798,"y":40.20501586,"z":76.68339473,"t":3.052621768,"spd":0.25}
[lineNum: 9 ] - {"T":111,"cmd":3000}
[lineNum: 10 ] - {"T":114,"led":0}
[lineNum: 11 ] - {"T":1,"mode":1}
^^^ ^^^ ^^^ reading file: mission_a.mission ends. ^^^ ^^^ ^^^
The actual file contents in the mission_a.mission file are as follows:
{"name":"mission_a","intro":"test mission created in flash."}
{"T":104,"x":235,"y":0,"z":234,"t":3.14,"spd":0.25}
{"T":104,"x":104.3172406,"y":-112.6415887,"z":65.13450799,"t":2.448233337,"spd":0.25}
{"T":114,"led":155}
{"T":104,"x":-163.7763876,"y":-138.2353466,"z":105.0922663,"t":2.466641107,"spd":0.5}
{"T":114,"led":0}
{"T":114,"led":255}
{"T":104,"x":156.428798,"y":40.20501586,"z":76.68339473,"t":3.052621768,"spd":0.25}
{"T":111,"cmd":3000}
{"T":114,"led":0}
{"T":1,"mode":1}
{"T":203,"name":"file.txt"}
{"T":204,"name":"file.txt","content":"inputContentHere."}
{"T":205,"name":"file.txt","lineNum":3,"content":"content"}
{"T":206,"name":"file.txt","lineNum":3,"content":"Content"}
{"T":207,"name":"file.txt","lineNum":3}
{"T":208,"name":"file.txt","lineNum":3}