Skip to content

Instantly share code, notes, and snippets.

@rosmianto
Created February 23, 2020 06:59
Show Gist options
  • Save rosmianto/607ab771ad3c6816cb7692312dac1a4f to your computer and use it in GitHub Desktop.
Save rosmianto/607ab771ad3c6816cb7692312dac1a4f to your computer and use it in GitHub Desktop.
How to List SD Card directory content Arduino Platform
Serial.println("List dir");
File root = SD.open("/");
File file = root.openNextFile();
while (file) {
Serial.print("FILE: ");
Serial.println(file.name());
file = root.openNextFile();
}
Serial.println("opening...");
File f = SD.open("/test.wav", "r");
if (!f) {
Serial.println("file open failed!");
}
else {
Serial.println("file open OK!");
f.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment