Use of SD.h while using tmrpcm.lib, conflict?

Hey Guys, I want to record .wav files and store them, so I use tmrpcm library. Also, in order to correctly save them, i need to get the folder and titles number on the SD card -> for that I use SD.h. But It seems that those two libraries have conflicts when use together. I looked into tmrpcm.cpp and it seems SD.h is included there already, but still, I can't use the printDirectory() function to iterate through the files, see below. That method is just from an example of the SD library.

Any of you know a workaround with these two libraries?

Thanks


void printDirectory(File dir, int numTabs) {
  Serial.println("enter");

  while (true) {

    Serial.println("op next file");
    File entry =  dir.openNextFile();
    if (!entry) {
      Serial.println("no files");
      break;
    }
    for (uint8_t i = 0; i < numTabs; i++) {
      Serial.print('\t');
    }
    Serial.println(entry.name());

    // for each file count it
    fileCountOnSD++;

    if (entry.isDirectory()) {
      Serial.println("found dir");
      dirCountOnSD++;
      Serial.println("/");
      printDirectory(entry, numTabs + 1);
    } else {
      // files have sizes, directories do not
      Serial.print("\t\t");
      Serial.println(entry.size(), DEC);
   }
    entry.close();
  }
  Serial.println("leave");
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.