//////////////////////////////////// SETUP void setup() { Serial.begin(9600); // set up Serial library at 9600 bps for debugging putstring_nl("\nWave test!"); // say we woke up! putstring("Free RAM: "); // This can help with debugging, running out of RAM is bad Serial.println(FreeRam()); // if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you if (!card.init()) { //play with 8 MHz spi (default faster!) error("Card init. failed!"); // Something went wrong, lets print out why } // enable optimize read - some cards may timeout. Disable if you're having problems card.partialBlockRead(true); // Now we will look for a FAT partition! uint8_t part; for (part = 0; part < 5; part++) { // we have up to 5 slots to look in if (vol.init(card, part)) break; // we found one, lets bail } if (part == 5) { // if we ended up not finding one :( error("No valid FAT partition!"); // Something went wrong, lets print out why } // Lets tell the user about what we found putstring("Using partition "); Serial.print(part, DEC); putstring(", type is FAT"); Serial.println(vol.fatType(), DEC); // FAT16 or FAT32? // Try to open the root directory if (!root.openRoot(vol)) { error("Can't open root dir!"); // Something went wrong, } // Whew! We got past the tough parts. putstring_nl("Files found (* = fragmented):"); // Print out all of the files in all the directories. root.ls(LS_R | LS_FLAG_FRAGMENTED); }