first of all I'm sorry for my english.
My problem is that I want to use an array of numbers on a funcion, but I'm getting a weird result inside a for loop. Doing some tests I've seen that it happen even in the simplest sketch so I should be doing something wrong.
I've created a two level int and I want to itinerate through the second level using a for loop. Outside the for loop all data gotten from that array is OK, but just inside the loop I'm just getting garbage like if the array was not initialized.
My simple sketch is this:
const int number_small[][14] PROGMEM = {
{124, 124, 387, 387, 399, 399, 443, 443, 483, 483, 387, 387, 124, 124},
};
void setup() {
Serial.begin(9600);
Serial.print(String(number_small[0][0]) + "\n");
Serial.print(String(number_small[0][1]) + "\n");
Serial.print(String(number_small[0][2]) + "\n");
Serial.print(String(number_small[0][3]) + "\n");
Serial.print(String(number_small[0][4]) + "\n");
Serial.print(String(number_small[0][5]) + "\n");
Serial.print(String(number_small[0][6]) + "\n");
Serial.print(String(number_small[0][7]) + "\n");
Serial.print(String(number_small[0][8]) + "\n");
Serial.print(String(number_small[0][9]) + "\n");
Serial.print(String(number_small[0][10]) + "\n");
Serial.print(String(number_small[0][11]) + "\n");
Serial.print(String(number_small[0][12]) + "\n");
Serial.print(String(number_small[0][13]) + "\n\n\n");
for (int i = 0; i<14; i++){
Serial.print("I: " + String(i) + " - " + String(number_small[0][i]) + "\n");
}
}
void loop() {
}
And the output is:
124
124
387
387
399
399
443
443
483
483
387
387
124
124
I: 0 - 0
I: 1 - 184
I: 2 - 0
I: 3 - 1
I: 4 - 0
I: 5 - -18248
I: 6 - -18248
I: 7 - -18248
I: 8 - 0
I: 9 - 135
I: 10 - 0
I: 11 - 0
I: 12 - 769
I: 13 - 0
What I'm doing wrong?,
Thanks!!