This is just test code, just to learn. I have not used Arduino in a long time.
I loaded an array in PROGMEM to save on scratch-pad RAM.
Now, I want to see if I can walk through the array and read some elements.
In my code you can see if I hard code the array index pointers then I can access the data, other wise I can't. What am I missing?
Thank you in advance.
`
const char atest2 [20][ 5] PROGMEM =
{
{'0','Z','z'} ,
{'1','B','b'} ,
{'2','C','c'} ,
{'3','D','d'} ,
{'4','E','e'} ,
{'5','F','f'} ,
{'6','G','g'} ,
{'7','H','h'} ,
{'8','I','i'} ,
{'9','J','j'} ,
} ;
byte nCounter = 1 ;
char cTemp2 = '.' ;
void setup()
{
Serial.begin( 56700 ) ;
}
void loop()
{
nCounter ++ ;
// this returns "2Cc" correctly
Serial.print( atest2 [2][0]) ;
Serial.print( atest2 [2][1]) ;
Serial.println( atest2 [2][2]) ;
//this does not work correctly
Serial.print( atest2 [nCounter][0]) ;
Serial.print( atest2 [nCounter][1]) ;
Serial.println( atest2 [nCounter][2]) ;
delay(1000) ;
if ( nCounter > 9 )
{
nCounter = 0 ;
}
}`