Looking help for opening SD file from LCD screen!!

Hi everyone,

First thank you for reading my post. I'm working on a project that involves communication between LCD, SD card using arduino.
The task includes displaying the files stored in the SD card on the LCD screen, then opening the file and send it to the arduino.

Since I don't have much experience with arduino, so what I did was modifying the SDFile.ls() and SDFile.printDirName() function such that they jam all the file name into one single string. The file names is then extracted from this string (based on the pattern of the string) and stored into an array. So I have the file names (8.3 format) and display it on the LCD screen. Because I failed to extract the path of the file name, I can only open the files that is in the root, and only the first file in each subdirectory.

I would greatly appreciate any help to get the file name to display on the LCD screen and the path to open it. What I did may not be the right method, can anyone give me some guidance. Thank you very much.

Eric D

Here is what it looks like from Serial.print();
//Output from calling SDFile.ls():

//Those name is store into this string,( the pattern made it hard to extract the path name for each file, I think)

//The string is then store into this array
SS1.TXT //***this file doesn't has a path


I am working on this topic since some time. My goal is to display the SD card file structure on a display:

This will not display the entire file structure but will allow navigation through the directory structure with two or more external buttons.

The file selection box is based on the m2tklib user interface library. The description for the m2tk file selection box is already online: http://code.google.com/p/m2tklib/wiki/fileselectbox. Everything will be available with the next m2tklib release.

Together with the LiquidCrystal port of m2tklib, this file selection box is also available for character displays (without icons on the left side). A lot of LCD and OLED displays are supported by the combination of m2tklib and u8glib (see the device list here: Google Code Archive - Long-term storage for Google Code Project Hosting.), but also GLCDv3 and m2tklib will work together.

After selection of a file, the full pathname is avilable within the Arduino: Google Code Archive - Long-term storage for Google Code Project Hosting.. The result can be used to open a file for reading or writing.
M2tklib and the mass storage subsystem (will be part of the next m2tklib) currently support the SD lib, SdFat lib and the Petit Fat File System lib.

Maybe you can specify your sd-card library and the intended display for a more precise answer. I can also offer a pre-release of m2tklib.


M2tklib with the file selection box is now available for download.

Supported fat file system libraries are:

  • Arduino SD
  • SdFat
  • Petit File System (read only version included with M2tklib)

M2tklib will work with a large range of displays. All displays, supported by the following libraries, can be used: