Ok so I'm stuck, and since I stared this thread here about reading the SD, I will keep this here as well, even though it could also go in the Programming section. So, right now, the patterns are stored in PROGMEM like so:
#define PAT1
prog_uchar img1[] PROGMEM = {
0x52,0x52,0x52,0x52,0x54, ...,0x7E,0x7E, (48 values per line)
0x72,0x74,0x74,0x4A,0x54, ...,0x7E,0x7E,
etc., etc.
};
#define REP1 172
#define PAUSE1 0
#define ELONG1 1411
Each pattern is different of course, so the amount of lines of color codes varies for each. All of them end with the same three lines at the bottom (with different values.) Then the code snippet I posted above will read that data in and pass it on to the LED string.
What I'd like to do is take that and put it in a file on the SD card; each pattern in a separate file. Right now, depending on the complexity of the patterns, I can have somewhere between 2 to 15 patterns within the 32K on an Uno.
What I'd much rather do is offload all the patterns to an SD card, then have the running code read them in as it needs them. Each pattern gets displayed for a specific amount of time, some for 5 seconds, others for 15 seconds, others for much longer (that's where the REP* value comes into play.)
This is where I'm stuck: how do I store the data offline in a file, in a specific structure, then read it back in for the program to use. I don't think I need to use PROGMEM with this, so I'll just be storing the actual data and three variables at the end. But how do I read it back in and how do I store it temporarily for the program loop to use? I say temporarily because when it needs to go to the next pattern, it can erase the old pattern and read in a new one.
And then there is the issue of the delay in accessing and reading the data that I want to figure out how to minimize. I don't want the program to stop displaying a pattern while it accesses the SD card and reads in data. I don't know if that can even be done. Maybe a second AVR that reads in data then waits for the primary one to request a new pattern and push it through a serial connection between the two? I don't know ...
Ideas, suggestions?