Hi there,
I've had a spare Arduino Nano lying around for years and wanted to hook it up to an LED Matrix.
I don't have a MAX7219, but I thought the Nano should have enough outputs to handle this anyway.
This is how I hooked it up:
I made an array that maps the pins of the matrix to the corresponding pins of the Nano. I also created to arrays to map rows and columns to the pins of the led matrix.
int ROWS[8] = { 9, 14, 8, 12, 1, 7, 2, 5};
int COLS[8] = {13, 3, 4, 10, 6, 11, 15, 16};
int PINS[16] = {12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
13, 14, 15, 16, 17};
I am then trying to light up the top left LED using the following code:
void setup()
{
for (int i = 0; i < sizeof(PINS) / sizeof(int); i++)
{
int pin = PINS[i];
pinMode(pin, OUTPUT);
}
}
void loop()
{
int row = 0;
int col = 0;
for (int i = 0; i < sizeof(ROWS) / sizeof(int); i++)
{
int rowPin = PINS[ROWS[i]-1];
digitalWrite(rowPin, i == row);
for (int j = 0; j < sizeof(COLS) / sizeof(int); j++)
{
int colPin = PINS[COLS[j]-1];
digitalWrite(colPin, j != col);
}
}
}
And this is the result:
I fiddled around a little bit, but got more and more confused. I must be doing something fundamentally wrong. Any ideas?
Greetings

