I'm currently trying to code a simple program that would allow me to light up an individual LED on an 8X8 LED board using a double array.
Here are the problems:
All the rows can ON individually UNTIL I turn all 8 rows ON. When I do this the last column turns OFF by itself (see attached pictures).
The columns aren't even working properly either. Every time I assign a column ON, the last column faintly turns ON too (one of the LEDs light in that column is broken so that is expect to be OFF. See picture).
I think those are the reasons why I am not able to singly assign a particular LED to be ON according to assignments in the array. If someone could spot my mistakes, it would greatly be appreciated. Thanks!
int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int led8 = 8;
int led9 = 9;
int led10 = 10;
int led11 = 11;
int led12 = 12;
int led13 = 13;
int led16 = 16;
int led17 = 17;
int led18 = 18;
int led19 = 19;
int rowPins [8] ={led19, led18, led11, led7, led12, led5, led4, led16};//assigning each LED to a row.
int columnPins [8] ={led13, led17, led9, led10, led2, led8, led3, led6};//assigning each LED to a column
int image [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()
{
for (int i = 0; i<8; i++)
{
pinMode(rowPins[i], OUTPUT);
pinMode(columnPins[i], OUTPUT);
}
}//end of setup()
void loop ()
{
for (int y=0; y<8; y++)
{
for (int x=0; x<8; x++)
{
if (image[x][y]==1)
{
digitalWrite (columnPins[x], HIGH);
}
else
{
digitalWrite(columnPins[x], LOW);
}
}//end of 2nd for loop
digitalWrite(rowPins[y], LOW);
delayMicroseconds(100);
digitalWrite(rowPins[y], HIGH);
}//end of first for loop
}//end of loop