📦 Archived documentation: r1 (committed 2026-07-24) View current documentation →

sd.write()

sd.write(filename,data)

Write to a file on the SD Card

Easily write your string to a file on the SD card.

If the file does not exist it will be automatically created, if it already exists it will be overwritten.

Arguments

NameTypeRequiredDefaultDescription
filename string yes e.g. "config.json"
data string yes Data to write to the file

Returns

number 0 = no error, >0 = error code

Example

sd.write("hello.txt","Hello World!");