display sd content on lcd??? is it possible?

Can someone please inform me if it is possible to display text via lcd that is sent to a txt file on an SD connected to the arduino?

It looks quite possible. It looks like the SD and LiquidCrystal libraries have the capability to do that. Something along the lines of this might help:

lcd.write(SD.read(file.txt)) //use file name

this is not tested by me, it should grab the contents of the file and put it on the lcd display. Also note that this is assuming you are using the standard Arduino SD and LiquidCrystal libraries. It also has no context code to set the cursor or the condition to see if the file is available.

Here is a helpful short tutorial page about reading files on the sd card:

If you are looking for a specific line on the SD card's file, that looks much tougher if possible at all. I suggest you just keep a larger quantity of very small files so they fit on the lcd display and only display what you want them to.

Which LCD? The simple 2-line 20-char units that have been around forever have good readability in all lighting and they usually have a good backlight so they can be read in the dark.

Graphical LCD screens can display colour images, text or whatever you want. Images must be stored on SD cards as even the smallest is too big for an Arduino's memory.

The short answer is "Yes." But you should give more information to get a more informative answer.

If you do need to read a specific line, you can try my library.

SD_Extension.zip (4.39 KB)

What is the goal of your project? Computers can read SD cards and display files on their screens. There must be some reasons you have to use an Arduino to do this, but what reasons?

With a graphical screen you can choose font size.

You can store a few novels in program memory with simple text-compression.

liudr:
What is the goal of your project? Computers can read SD cards and display files on their screens. There must be some reasons you have to use an Arduino to do this, but what reasons?

It might make a good speed reading machine, better than what we had in 1970.
It would only have to be one fixation wide if the user trains on it.

I have tested and it works.

As someone mentioned I do not seem to have control on the cursor when displaying an SDFile.

Thanks for all your help.

void readSD()
{
  lcd.print("Reading File");
  delay(1000);
  File dataFile = SD.open(filename2);
  if (dataFile) {
    lcd.clear();
    while (dataFile.available()) {
    lcd.write(dataFile.read());
    }
    dataFile.close();
  }
}

ao90:
I have tested and it works.

As someone mentioned I do not seem to have control on the cursor when displaying an SDFile.

    while (dataFile.available()) {

lcd.write(dataFile.read());
    }

Maybe because your blocking read loop.

I haven’t changed anything since yesterday and yet this morning when I run the readSD function it does not display any content.

Does anyone have any suggestions as to why?

void lcdlog(char *txt)
  {
     if (dataFile) {
  File dataFile = SD.open(filename2, FILE_WRITE);
  DateTime now = RTC.now();
  dataFile.print(txt);
  dataFile.print(now.day(), DEC);
  dataFile.print("/");  
  dataFile.print(now.month(), DEC);
  dataFile.print(now.hour(), DEC);
  dataFile.print(":");
  dataFile.print(now.minute(), DEC);
  dataFile.close(); 
    }
  } 

void readSD()
{
  lcd.print("Reading File");
  delay(1000);
  lcd.clear();
  if (dataFile) {
    File dataFile = SD.open(filename2);
    lcd.write(dataFile.read());
    dataFile.close();
  }
}

Was it different yesterday? Check your wiring, run a known working sketch.

GoForSmoke:
It might make a good speed reading machine, better than what we had in 1970.
It would only have to be one fixation wide if the user trains on it.

In absence of the OP's response, I assume this is just a homework exercise.

No I was just on holiday sorry all.

I am back to having it work again I can’t remember now that I am back what the issue is.

However I still run into the problem of having no control of the cursor when reading the SD to the LCD.

Does anyone know how to solve this?

Try something already suggested? Perhaps show results?

Found a solution. Created two files for the content I wanted. The event is stored and then displayed then cursor is set to the following row and the time & date stamp is displayed. Simple solution as the lcd.println function does not work the same as the Serial.println function.

I am still curious. You read a very short file on SD card, display it entirely on line 1, then display date and time on line 2. What is the use of this thing?

ao90:
Found a solution. Created two files for the content I wanted. The event is stored and then displayed then cursor is set to the following row and the time & date stamp is displayed. Simple solution as the lcd.println function does not work the same as the Serial.println function.

Cursor working now?