Disk operations

When SD has been initialized properly, pointers can be used to access partition, file system and root directory. There are some functions that return information about the SD card.

Disk information

Stores all the data containing the disk info into the buffer. It returns a filled buffer if success on getting disk info and an empty string if not.

Example of use

{
 // Gets disk info, returning it and storing this info in 'SD.buffer'
 SD.print_disk_info();
 USB.println(SD.buffer);
}

Available Information

SD.buffer→ stores the data received as a human-readable encoded string.

diskInfo → pointer to SD.buffer

An example of the output by this system would be:

manuf: 0x1b oem: SM prod: 21e7 rev: 1.0 serial: 0xedb6c604 date: 11/10

Disk Size

Gets the total size of the SD card.

It returns ‘diskSize’ variable and updates its value. Size is stored and returned in Bytes.

Example of use

{
 // Get total size of SD card
 diskSize = SD.getDiskSize();
 USB.println(SD.diskSize);
 }

Related Variables

SD.diskSize → stores the total size of the SD card.

An example of the value would be: SD.diskSize=992608256

Last updated