Hi guys, i'm quite noob on arduino stuff, but i'm try to learn something new for my little project.
I've a large file, very large, with a list of recipes, are about 10.000 lines and 10 columns (maybe i can remove 2 or 3 that aren't necessary).
I can't store it on arduino, i'm using a mega 2560, i've stored on the micro sd under the TFT LCD 2.4". This file is a .csv file of about 500KB and doesn't change.
There is any chance to read this file on arduino just like a "standard" array of char?
I've tested the SdFat library, and modded some variables to use it on my Mega (pins are different from 1, and i got issues before).
I can read the file without issues, i've tested a print on serial, it required 8 minutes to print all the lines!!!Without print on serial, to read all the file it tooks about 16 seconds.
The idea is to create a page on LCD where the user can select one of the recepies, maybe selecting the first letter of the total, and start serching for that recepies starting with that letter.
Can be very very nice to have some predictive text suggestion according the names of the recepies.
Thanks in advance for help/suggestions, and good sunday!
J
Your project doesn't seem well suited to an Arduino; large amounts of data which will have to remain on the SD card and a clunky interface that'll make scrolling through a lot of recipes necessary.
Assuming that this is a learning exercise though, you could sort the csv file (using a PC) and then when the Arduino starts up, read the file and build an index that tells you where recipes starting with each letter begin. Then at least, when you provide the first letter, you can seek to that position rather than reading line by line.
As a slightly more sophisticated version, you could use the first two letters - the Mega has plenty of RAM for such an index and then you're only scrolling through a manageable number of recipes rather than hundreds.
As to why serial.printing the file is so slow, I'd guess that you are printing at 9600 baud. Try 115200.