hy i'm making a program to drive 10 5*7 led matrixes
it will eventually be an alarmclock, but I want to make it possible to print text onto my displays.
because of this I defined all letters in 2D arrays so I know which leds have to go on and which not.
I used a switch case to send my letters into a transfer array to put it eventually into a larger (50+*7) array so I can use that to print the time. note that the length of the final array can differ and the content of it to, so I cannot hardcode it.
the problem is it never wants to compile because of the 2D array in the switch case. it most of the time gives me this problem code : cannot convert '' to int in assignment
i tried to fix it various ways, of which 3 are listed here
#define seven {\
{1, 1, 1, 1, 1, 0}, \
{0, 0, 0, 0, 1, 0}, \
{0, 0, 0, 1, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}}
#define eight {\
{0, 1, 1, 1, 0, 0}, \
{1, 0, 0, 0, 1, 0}, \
{1, 0, 0, 0, 1, 0}, \
{0, 1, 1, 1, 0, 0}, \
{1, 0, 0, 0, 1, 0}, \
{1, 0, 0, 0, 1, 0}, \
{0, 1, 1, 1, 0, 0}}
#define nine {\
{0, 1, 1, 1, 0, 0}, \
{1, 0, 0, 0, 1, 0}, \
{1, 0, 0, 0, 1, 0}, \
{0, 1, 1, 1, 1, 0}, \
{0, 0, 0, 0, 1, 0}, \
{1, 0, 0, 0, 1, 0}, \
{0, 1, 1, 1, 0, 0}}
int matrix[7][6];
String spaces = " ";
const int row[7] = {};
//cathodes
const int col[50] = {};
//anodes
const byte pixels[7][50];
void CharacterChoise(char character)
{
switch (character)
{
case'7':
matrix = {\
{1, 1, 1, 1, 1, 0}, \
{0, 0, 0, 0, 1, 0}, \
{0, 0, 0, 1, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}, \
{0, 0, 1, 0, 0, 0}}
break;
case '8':
matrix = eight
break;
case'9':
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 6; j++)
{
matrix[i][j] = nine[i][j];
}
}
break;
default:
break;
}
}
void PrintWords(String woorden)
{
String prints = String(spaces + woorden + spaces);
byte woordLeds[(strlen(prints) * 6][7];
for (int i = 0; i < (strlen(prints) * 6; i += 6)
{
character[7][6] = CharacterChoise[prints[i / 6]];
for (int j = 0; j < 6; j++)
{
for (int k = 0; k < 7; k++)
{
woordLeds[k][i + j] = character[k][j];
}
}
}
for (int i = 0; i < (strlen(prints) * 6; i++)
{
for (int j = 0; j < 50; j++)
{
for (int k = 0; k < 7; k++)
{
pixels[k][j] = woordLeds[k][i + j];
}
}
for (int j = 0; j < 100; j++)
{
PrintScreen();
}
}
}
void PrintScreen() {
// iterate over the rows (anodes):
for (int thisRow = 0; thisRow < 7; thisRow++) {
digitalWrite(row[thisRow], LOW);
for (int thisCol = 0; thisCol < 50; thisCol++) {
int thisPixel = pixels[thisRow][thisCol];
digitalWrite(col[thisCol], thisPixel);
}
}
digitalWrite(row[thisRow], HIGH);
delay(10);
digitalWrite(row[thisRow], LOW);
}
i've already read dozens of topics to find the solution but saidly i couldn't find it.
does anyone had this problem before?
thanks for the help in advance.
greetz,
RayanR