I have my Arduino Uno hooked up to a 5x7 led matrix. Here is my code:
int colPins[] = {A0, A1, A2, A3, A4};
int rowPins[] = {2, 3, 4, 5, 6, 7, 8};
int allPins[] = {A0, A1, A4, A2, A3, 8, 7, 2, 6, 3, 4, 5};
int led = 13;
int time;
int delayTime = 500;
int A[7][5] = {
{0, 0, 1, 0, 0},
{0, 1, 0, 1, 0},
{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}
};
int B[7][5] = {
{1, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 0, 0, 1},
{1, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 0, 0, 1},
{1, 1, 1, 1, 0}
};
int L[7][5] = {
{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}
};
int K[7][5] = {
{1, 0, 0, 0, 1},
{1, 0, 0, 1, 0},
{1, 0, 1, 0, 0},
{1, 1, 0, 0, 0},
{1, 0, 1, 0, 0},
{1, 0, 0, 1, 0},
{1, 0, 0, 0, 1}
};
int E[7][5] = {
{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, 1, 1, 1, 1}
};
void allOff()
{
for(int i = 0; i < 12; i++)
{
pinMode(allPins[i], INPUT);
digitalWrite(allPins[i], LOW);
}
}
void displayCharacter(int character[7][5], int length)
{
time = millis();
while(millis() - time < length)
{
for(int row = 0; row < 7; row++)
{
for(int col = 0; col < 5; col++)
{
if (character[row][col] == 1)
{
pinMode(colPins[col], OUTPUT);
pinMode(rowPins[row], OUTPUT);
digitalWrite(colPins[col], LOW);
digitalWrite(rowPins[row], HIGH);
delayMicroseconds(delayTime);
allOff();
}
}
}
}
}
void setup()
{
allOff();
//Serial.begin(9600);
}
void loop()
{
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
displayCharacter(B, 1000);
displayCharacter(L, 1000);
displayCharacter(A, 1000);
displayCharacter(K, 1000);
displayCharacter(E, 1000);
//Serial.println(millis());
}
The rotation of the letters in the word "BLAKE" each appear 5 times. After that, the B shows for a second, the L shows for a second, and then the circuit just stops working. No LED's blink anymore. I put this in the troubleshooting section because it doesn't seem to be a programming question (although I might be wrong). What could be the problem???