 # LED Matrix pattern

So I built a standard jumper Row + Column LED matrix (using individual LEDs) Its currently 2x5. What I want to understand is how, if I wanted to, could I make patterns in there, without using a really bulky and ugly "counting" system.

I see words in there, but not much meaning.

Jesus, I must learn to multi-task better while typing. Essentially this is what I have:

1:* * 2:* * 3:* * 4:* * 5:* * a b

with each * being 1 LED. I want to make a pattern, flash through it. Right now I have an ugly if else statement just cycling the lights through it, but I want something less bulky and more dynamic.

Post what you have. Having said that, a for loop and an array of data describing the pattern are likely going to be a working answer

edit: spelling

``````int ROW = 9;
int COL = 4;
int count = 1;

void setup() {
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(300);
}

void loop() {
Serial.print("Column: ");
Serial.print(COL);
Serial.print(10, BYTE);
Serial.print("Row: ");
Serial.print(ROW);
Serial.print(10, BYTE);
Serial.print("Count: ");
Serial.print(count);
Serial.print(10, BYTE);

if (COL == 4 && count == 1)
{
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
COL = 5;
}

else
{
if (count == 1){
digitalWrite(5, LOW);
digitalWrite(4, HIGH);
COL = 4;
}
}

count = 0;

if (ROW < 13)
{
digitalWrite(ROW, HIGH);
digitalWrite(ROW-1, LOW);
delay(50);
ROW = ROW+1;
}

if (ROW == 13)
{
digitalWrite(ROW, HIGH);
digitalWrite(ROW-1, LOW);
delay(100);
count = 1;
ROW = 9;
}

}
``````