     infile->openNext(curr_dir);
     if (infile->isOpen()) {
       if (!infile->isDir() && !infile->isHidden() && !infile->isSystem()) {
+        ++curr_index;
 #ifdef DEBUG
         char buf[13];
         infile->getName(buf, sizeof(buf));
-        cout << F("\nOpened file: ") << buf;
+        cout << F("\nnext opened file ") << (int16_t)curr_index << F(": ") << buf;
 #endif
         return;
       }
       infile->close();
     } else {
       curr_dir->rewind();
+      curr_index = 0;
     }
   }
 }


#define infile (&(Context->file))
#define curr_dir (&(Context->dir))

unsigned long startMillis;


enum {
  SD_CHIP_SELECT = 4,
  APA106_DATA = 6,
  SHIFT_REGISTER_CLOCK = 8,
  SHIFT_REGISTER_LATCH = 9,
  SHIFT_REGISTER_DATA = 10,
  SD_MISO = 11,
  SD_MOSI = 12,
  SD_CLK = 13,
