Hello all. I'm a beginner and I'm trying to make an LED matrix output the string FREE UYGHUR! using the Arduino. However, for some reason the letters F, both R's and the ! do not light up correctly. The problem isn't the pixels themselves because other letters use the same pixels and they light up correctly. I'd appreciate any help on determining why these letters don't light up.
Here is the code:
// 2-dimensional array of row pin numbers:
const int rownum[8] = {
10,12,15,17,2,4,6,8 };
// 2-dimensional array of column pin numbers:
const int colnum[8] = {
11,14,16,18,3,5,7,9 };
float timeCount = 0;
int f[8][8] = {
{0,0,1,1,1,1,1,0},
{0,0,1,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,1,1,1,1,1,0},
{0,0,1,1,1,1,1,0},
{0,0,1,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,1,0,0,0,0,0}};
int r[8][8] = {
{0,0,1,1,1,1,0,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,1,1,1,0,0},
{0,0,1,1,1,0,0,0},
{0,0,1,0,0,1,0,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,0,1}};
int e[8][8] = {
{0,0,1,1,1,1,1,0},
{0,0,1,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,1,1,1,1,1,0},
{0,0,1,1,1,1,1,0},
{0,0,1,0,0,0,0,0},
{0,0,1,0,0,0,0,0},
{0,0,1,1,1,1,1,0}};
int u[8][8] = {
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,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,0,0}};
int y[8][8] = {
{0,1,0,0,0,0,0,1},
{0,0,1,0,0,0,1,0},
{0,0,0,1,0,1,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,1,0,0,0}};
int g[8][8] = {
{0,0,1,1,1,1,0,0},
{0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0},
{0,1,0,0,0,1,1,1},
{0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0},
{0,0,1,1,1,1,0,0}};
int h[8][8] = {
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,1,1,1,1,0},
{0,0,1,1,1,1,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0},
{0,0,1,0,0,0,1,0}};
int x[8][8] = {
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,1,1,0,0,0},
{0,0,0,1,1,0,0,0}};
int blank[8][8] = {
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0}};
void setup() {
Serial.begin(9600);
// initialize the I/O pins as outputs:
// iterate over the pins:
for (int thisPin = 0; thisPin < 8; thisPin++) {
// initialize the output pins:
pinMode(colnum[thisPin], OUTPUT);
pinMode(rownum[thisPin], OUTPUT);
// take the col pins (i.e. the cathodes) high to ensure that
// the LEDS are off:
digitalWrite(colnum[thisPin], LOW);
digitalWrite(rownum[thisPin], HIGH);
}
}
void loop() {
// This could be rewritten to not use a delay, which would make it appear brighter
delay(5);
timeCount += 1;
if(timeCount < 200) {
drawScreen(f);
} else if (timeCount < 230) {
// do nothing
} else if (timeCount < 400) {
drawScreen(r);
} else if (timeCount < 430) {
// nothing
} else if (timeCount < 600) {
drawScreen(e);
} else if (timeCount < 630) {
// nothing
} else if (timeCount < 800) {
drawScreen(e);
} else if (timeCount < 830) {
// nothing
} else if (timeCount < 1000) {
drawScreen(u);
} else if (timeCount < 1030) {
// nothing
} else if (timeCount < 1200) {
drawScreen(y);
} else if (timeCount < 1230) {
// nothing
} else if (timeCount < 1400) {
drawScreen(g);
} else if (timeCount < 1430) {
// nothing
} else if (timeCount < 1600) {
drawScreen(h);
} else if (timeCount < 1630) {
// nothing
} else if (timeCount < 1800) {
drawScreen(u);
} else if (timeCount < 1830) {
// nothing
} else if (timeCount < 2000) {
drawScreen(r);
} else if (timeCount < 2030) {
// nothing
} else if (timeCount < 2200) {
drawScreen(x);
} else if (timeCount < 2230) {
// nothing
} else {
// back to the start
timeCount = 0;
}
}
int row(int i) {
if(i == 1) {
return 10;
} else if (i == 2) {
return 12;
} else if (i == 3) {
return 15;
} else if (i == 4) {
return 17;
} else if (i == 5) {
return 2;
} else if (i == 6) {
return 4;
} else if (i == 7) {
return 6;
} else if (i == 8) {
return 8;
}
}
int col(int i) {
if(i == 1) {
return 11;
} else if (i == 2) {
return 14;
} else if (i == 3) {
return 16;
} else if (i == 4) {
return 18;
} else if (i == 5) {
return 3;
} else if (i == 6) {
return 5;
} else if (i == 7) {
return 7;
} else if (i == 8) {
return 9;
}
}
void drawScreen(int character[8][8]) {
for(int j = 0; j < 8; j++) {
// Turn the row on
int rowNumber = j + 1;
digitalWrite(row(rowNumber), LOW);
for (int k = 0; k < 8; k++) {
// draw some letter bits
int columnNumber = k + 1;
if(character[j][k] == 1) {
digitalWrite(col(columnNumber), HIGH);
}
digitalWrite(col(columnNumber), LOW);
}
digitalWrite(row(rowNumber), HIGH);
}
}