Hello Everyone,
Well, I'm currently working on a LET matrix display, and I'm using a tri dimensional boolean-type matrix to store values for LED's statuses when displaying each letter as follows:
#include <avr/pgmspace.h>
PROGMEM boolean CharacterVector[26][8][5] = {
{
{1,1,1,1,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,1,1,1,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1}
},{
{1,1,1,1,1},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,1,1,0},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,0,0,1},
{1,1,1,1,1}
},{
{1,1,1,1,1},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,1,1,1,1}
},{
{1,1,1,1,0},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,0,0,1},
{0,1,0,1,1},
{1,1,1,1,0}
},{
{1,1,1,1,1},
{1,0,0,0,0},
{1,0,0,0,0},
{1,1,1,1,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,1,1,1,1}
},{
{1,1,1,1,1},
{1,0,0,0,0},
{1,0,0,0,0},
{1,1,1,1,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0}
},{
{1,1,1,1,1},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,0,0,0},
{1,0,1,1,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,1,1,1,1}
},{
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,1,1,1,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1}
},{
{1,1,1,1,1},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0},
{1,0,1,0,0},
{0,0,1,0,0},
{1,1,1,1,1}
},{
{1,1,1,1,1},
{0,0,1,0,0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,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0}
},{
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,1,1,1,1}
},{
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{0,1,0,1,0},
{0,0,1,0,0}
},{
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,1,0,1},
{1,1,0,1,1},
{1,0,0,0,1}
},{
{1,0,0,0,1},
{1,0,0,0,1},
{0,1,0,1,0},
{0,0,1,0,0},
{0,1,0,1,0},
{1,0,0,0,1},
{1,0,0,0,1},
{1,0,0,0,1}
},{
{1,0,0,0,1},
{0,1,0,1,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,1,0},
{0,0,1,0,0},
{0,0,1,0,0},
{0,0,1,0,0}
},{
{1,1,1,1,1},
{0,0,0,0,1},
{0,0,0,0,1},
{0,0,0,1,0},
{0,0,1,0,0},
{0,1,0,0,0},
{1,0,0,0,0},
{1,1,1,1,1}
}
};
I used the pgmspace lib cause I was having issues with RAM on the UNO.
Still, one would think that I could get the first letter printed out to the serial port by using this:
for(int i=0 ; i<8 ; i++){
for(int j=0 ; j<5; j++){
Serial.print(CharacterVector[0][i][j]);
Serial.print(" ");
}
Serial.print("\n");
}
but what I get at the Serial Port is this:
0 0 2 0 0
0 1 0 0 2
2 2 2 2 2
2 0 0 135 0
0 2 0 0 1
3 0 2 103 0
0 0 0 0 0
0 2 2 2 2
when I should be getting this:
1 1 1 1 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 1 1 1 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
So, I tried it out without using for's, the most straightforward way to print it:
Serial.print(CharacterVector[0][0][0]);
Serial.print(CharacterVector[0][0][1]);
Serial.print(CharacterVector[0][0][2]);
Serial.print(CharacterVector[0][0][3]);
Serial.print(CharacterVector[0][0][4]);
Serial.print("\n");
Serial.print(CharacterVector[0][1][0]);
Serial.print(CharacterVector[0][1][1]);
Serial.print(CharacterVector[0][1][2]);
Serial.print(CharacterVector[0][1][3]);
Serial.print(CharacterVector[0][1][4]);
Serial.print("\n");
Serial.print(CharacterVector[0][2][0]);
Serial.print(CharacterVector[0][2][1]);
Serial.print(CharacterVector[0][2][2]);
Serial.print(CharacterVector[0][2][3]);
Serial.print(CharacterVector[0][2][4]);
Serial.print("\n")
Serial.print(CharacterVector[0][3][0]);
Serial.print(CharacterVector[0][3][1]);
Serial.print(CharacterVector[0][3][2]);
Serial.print(CharacterVector[0][3][3]);
Serial.print(CharacterVector[0][3][4]);
Serial.print("\n")
Serial.print(CharacterVector[0][4][0]);
Serial.print(CharacterVector[0][4][1]);
Serial.print(CharacterVector[0][4][2]);
Serial.print(CharacterVector[0][4][3]);
Serial.print(CharacterVector[0][4][4]);
Serial.print("\n")
Serial.print(CharacterVector[0][5][0]);
Serial.print(CharacterVector[0][5][1]);
Serial.print(CharacterVector[0][5][2]);
Serial.print(CharacterVectors[0][5][3]);
Serial.print(CharacterVector[0][5][4]);
Serial.print("\n")
Serial.print(CharacterVector[0][6][0]);
Serial.print(CharacterVector[0][6][1]);
Serial.print(CharacterVector[0][6][2]);
Serial.print(CharacterVector[0][6][3]);
Serial.print(CharacterVector[0][6][4]);
Serial.print("\n")
Serial.print(CharacterVector[0][7][0]);
Serial.print(CharacterVector[0][7][1]);
Serial.print(CharacterVector[0][7][2]);
Serial.print(CharacterVector[0][7][3]);
Serial.print(CharacterVector[0][7][4]);
and get the expected output.
I've even tried substituting the term CharacterVector[0][j] for CharacterVector[0][0][0] or CharacterVector[0][1][1] to get all 1's and all 0's 8x5 matrixes respectively, and it works. It just doesnt seem to work when I try it with the indexes i and j in between the for's.
Any help would be much appreciated.