class SD

The SD object can give important information about the SD card and is able to perform a format in FAT32 on the SD card.

Constructor

class obs.SD

Create an SD object associated with the SD card.

Methods

SD.format()

Perform a format in FAT32 to create a single partition

SD.size() → integer

Get the size of the SD card in Kilo Bytes.

SD.free_space() → integer

Get the unused size of the SD card in Kilo Bytes.

SD.detect() → boolean

Return true if the SD card is connected otherwise it returns false.

Example usage

The following code shows an example calculating the amount of free memory in a percentage.

import obs

sd = obs.SD()
percentage = (100 / sd.size()) * sd.free_space()
print(percentage, '%');