Arduino mega 2560 SD filenames to array/LCD

Hi, I am currently working on a school project and am making an Arduino controlled shuttlecock launcher. As part of this, I am planning to make a system where you can create training routines to store on a micro SD card.

I would like to be able to display all the file names from a directory called "Programs" onto my 20x4 LCD so I can view what files are on the SD card and delete them if they are selected (done with the viewFiles function).

The current problem I am having is that I cannot add the filenames to a char array so my menu function cannot output them to the LCD Display.

Code is attached.

shuttlecock_launcher.ino (18.2 KB)

The SD file system uses the 8.3 filename methods so all your filenames will fit into a 13 char array. The easiest way to do this would be

//char* filesList[15] = {"", "", "", "", "", "", "", "", "", "", "", ""};
char filesList[13][15];  // NOTE: maximum of 15 files in the directory

and then when you are reading the directory

      //String filename =;
      //filesList[numFiles] = filename.c_str();

Make sure to add a check into this loop so numFiles does not exceed the size of your array.

Ok, thanks very much will try this soon when I have some time.