Skip to content

Commit

Permalink
Merge pull request #118 from per1234/improve-rewinddirectory-ref-code
Browse files Browse the repository at this point in the history
Make `File::rewindDirectory` reference demo code more clear
  • Loading branch information
per1234 authored Apr 25, 2022
2 parents 619fe19 + 0df9a9c commit d4ed450
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,13 @@ void setup() {
SD.begin(10);
root = SD.open("/");
printDirectory(root, 0);
Serial.println();
Serial.println("PRINT AGAIN");
Serial.println("-----------");
root.rewindDirectory(); // Return to the first file in the directory
printDirectory(root, 0);
Serial.println("Done!");
}
Expand All @@ -845,8 +852,6 @@ void printDirectory(File dir, int numTabs) {
File entry = dir.openNextFile();
if (!entry) {
// No more files
// Return to the first file in the directory
dir.rewindDirectory();
break;
}
Expand Down

0 comments on commit d4ed450

Please sign in to comment.