Hello All,
I'm working on a project that gets a data stream (sequence of bytes which I want to place in an array) and then does something with it. I would like to receive the stream and save it to the program memory because I would like to store 4096bytes and flash is not enough on my 328P.
The following section of my program is quite simple and works saving the elements to an array in flash memory:
...
unsigned char HelloMP3[1024] = { };
...
//******************SAVING ARRAY TO FLASH:
//DATA IS COMING IN FROM THE NETWORK
while (client2.connected()){
p = &HelloMP3[0];
while (p <= &HelloMP3[sizeof(HelloMP3)-1]) {
*p = client2.read();
p++;
}
}
//******************READING ARRAY
p = &HelloMP3[0]; // Point "p" to the beginning of array
while (p <= &HelloMP3[sizeof(HelloMP3)-1]) {
variable = p*;
p++;
}
now I would like to implement the exact same code but saving each element in progmem as they are made available or alternatively I can store the data on a 1024 array (I have this amount available in flash) and then transfer it to progmem and repeat this until I get to 4096bytes.
I hope I was clear enough! Any good ideas?
TIA,
Rui