I am working on a project where I want to print words to an LCD screen from an SD card. I have come across a few questions when it comes to reading the files and want to verify if I am understanding this correctly.
The first issue is that I have several lists on the SD card and want to conditionally open one. Each list has a strict naming format of list_xx.txt
would a statement like:
listToOpen=String("list_0"+listnum+".txt");//this only works if spot is between 0 and 9, a simple if statement can account for more lists.
work for opening a list between list_01 through list_09 assuming listnum is an int between 1 and 9? I would be using:
The second question I have is once the list is open I want to be able to quickly read one line from the list. Each line is exactly 20 characters but I was slightly confused as to how to use the read command.
This page Arduino - FileRead
describes the command as file.read(buf, len) I was confused as to what these parameters would do. Am I correct to think that buf is a buffer and len is a length such that I could use the following command:
String word = myFile.read(40,20);
which would give word the characters in the file starting with char 40 and ending with char 59?
One thing I would like to note is that my goal is to have 1000s of lines in a text and for that reason do not particularly want to read one line at a time and would instead prefer to jump to the specific line.
Thanks for any help