I was thinking to use the array as well, because I have a small aniimation of several pictures going on, and I would like to speed up the reading... so, the idea was to use the simple array to and go thru quicker, however, this is obviously not possible to do with the PROGMEM, any other ides how to approach this? I have around 10 monochrome pictures that I am playing... wondering what would be best way to manipulate that ...
Your problem is more likely caused by the speed at which the display can be updated, and not the slight additional time it takes to read PROGMEM vs ram. We need a lot more information, such as the type display and the actual code, to get an idea what the problem is.
Your problem is unrelated to the OP's problem, that was caused by not properly accessing the PROGMEM.
if you need to pass the data from your array in progmem to a function that expects the argument data to be in RAM, the code needs to first copy the data from the array value(s) from progmem to ram variable(s) and pass the ram variable to the sub-function
What frame rate are you trying to achieve?
Is your display using I2C or SPI? Definitely do not use the software implementation of either.
There are overloaded versions of drawBitmap(). If the array is declared const the data is assumed to be in PROGMEM, if not const the array is assumed to be in ram.
Copying the data from PROGMEM to ram, then displaying from ram, is unlikely to speed things up, and will likely be slightly slower, than letting the library read directly from PROGMEM.
< edit >
You may be able to speed things up a bit by eliminating the clearDisplay() and instead copying directly from PROGMEM to the display buffer (you can get the location of the buffer with getBuffer() ), bypassing the displayBitmap function entirely.
Indeed there is 24 of those frames ... and then the idea is to "print" them out, like you have suggested? But first the array is created-which is where I gett the first warning!
/Users/imac/Documents/Arduino/At_Tiny_3216/Display_Project_QT_2/animated_pic.ino:2143:1: warning: invalid conversion from 'const unsigned char*' to 'unsigned char' [-fpermissive]
Anyway, the array is created like that, not sure what is there a problem with converting the file? In adition, you have suggested to use the uint16?
So, should the frames be stored as "uint6_t" rather than "unsigned char" as it is now? BTW this compiles, however, this is not compiling:
for (byte k = 0; k < 5; k++){
Serial.println(k);
Serial.println(" ");
Serial.println (pgm_read_word_near(&icons[k]), HEX);
}
namely the error is in the Serial.println (pgm_read_word_near(&icons[k]), HEX);
the error is supposed to be in not declared array named icons which is strange?
...
'icons' was not declared in this scope
java.lang.NoSuchMethodError: accessibilityHitTest
...
Alrighty, I have found the problem, the point is in fact that the whole PROGMEM data must be before the setup(); For example , I had that code in a separate windows in Arduino...
So, how to organise this, I have quite a lot of code, hence I have put this away. So, how to make the Arduino IDE read the code properly?
Anyway, although the code of storing the pics into the PROGMEM now compiles ,
I am still stuck here:
void loop() {
for (byte k = 0; k < 5; k++){
Serial.println(k);
Serial.println(" ");
//Serial.println(pgm_read_byte(&table[k]));
Serial.println(pgm_read_word_near(&icons[k]));
}
}
pgm_read does not want to compile and here is the error:
exit status 1
Error compiling for board ATtiny3226/3216/1626/1616/1606/826/816/806/426/416/406.