The sd object reads and writes to the device memory card, letting you keep custom configurations or log
files alongside the built-in datalogger — useful for raw text logs, CSV
exports or audit trails.
SD cards must be formatted as Fat32. Cards up to 128GB.
To avoid long read and write delays we recommend keeping the directory structure small and avoiding large files.
Functions
sd.append() — Appends a string to a file on the memory card, creating the file if needed.
Read a file from the sd card and returns the result
Arguments
Name
Type
Required
Default
Description
filename
string
yes
—
e.g. "config.json"
Returns
object{error:0,data:"file contents"} 0 = No Error, data = file contents as a string
Example
let res = sd.read("hello.txt");
if(!res.error){
print(res.data); // Prints the contents of hello.txt
} else {
print("Failed to load file err=", string(res));
}