1. ## 3x3 LED Matrix

Here is another little project I have been working on the past few days. It is a simple 3x3 LED matrix with a demo video, schematic, and code. I am working on a 10x10 LED matrix and will post that when I finish it.

Schematic

Code
A little ugly with all the switch statements, but those will be gone as soon as I figure out how to get 3D arrays working on an arduino, or switch to my pi.
Code:
```int cathode[] = {0,1,2};
int anode[] = {5,4,3};

int one[][3] =   {{1,1,1}, {1,0,1}, {1,1,1}};
int two[][3] =   {{0,1,1}, {1,1,1}, {1,1,0}};
int three[][3] = {{0,1,1}, {1,0,1}, {1,1,0}};
int four[][3] =  {{0,1,0}, {1,1,1}, {0,1,0}};
int five[][3] =  {{0,1,0}, {1,0,1}, {0,1,0}};
int six[][3] =   {{0,1,0}, {0,1,0}, {0,1,0}};
//int* numbers[6][3][3] = {*one, *two, *three, *four, *five, *six};

int spiral1[][3] =   {{1,1,1}, {1,1,1}, {1,1,1}};
int spiral2[][3] =   {{1,1,1}, {1,1,1}, {0,1,1}};
int spiral3[][3] =   {{1,1,1}, {0,1,1}, {0,1,1}};
int spiral4[][3] =   {{0,1,1}, {0,1,1}, {0,1,1}};
int spiral5[][3] =   {{0,0,1}, {0,1,1}, {0,1,1}};
int spiral6[][3] =   {{0,0,0}, {0,1,1}, {0,1,1}};
int spiral7[][3] =   {{0,0,0}, {0,1,0}, {0,1,1}};
int spiral8[][3] =   {{0,0,0}, {0,1,0}, {0,1,0}};
int spiral9[][3] =   {{0,0,0}, {0,1,0}, {0,0,0}};
int spiral10[][3] =  {{0,0,0}, {0,0,0}, {0,0,0}};

int number = 0;
int mode = 0;

void setup() {
for(int i = 0; i < 7; i++){
if (i < 4){
pinMode(cathode[i], OUTPUT);
digitalWrite(cathode[i], LOW);
}
else{
pinMode(anode[i], OUTPUT);
digitalWrite(anode[i], LOW);
}
}
}

void loop() {
number++;
switch(mode){
case(0):
switch(number){
case(1):
writeMatrix(one, 100);
break;
case(2):
writeMatrix(two, 100);
break;
case(3):
writeMatrix(three, 100);
break;
case(4):
writeMatrix(four, 100);
break;
case(5):
writeMatrix(five, 100);
break;
case(6):
writeMatrix(six, 100);
number = 0;
mode = 1;
break;
off();
}
break;
case(1):
switch(number){
case(1):
writeMatrix(spiral1, 15);
break;
case(2):
writeMatrix(spiral2, 15);
break;
case(3):
writeMatrix(spiral3, 15);
break;
case(4):
writeMatrix(spiral4, 15);
break;
case(5):
writeMatrix(spiral5, 15);
break;
case(6):
writeMatrix(spiral6, 15);
break;
case(7):
writeMatrix(spiral7, 15);
break;
case(8):
writeMatrix(spiral8, 15);
break;
case(9):
writeMatrix(spiral9, 15);
break;
case(10):
writeMatrix(spiral10, 15);
number = 0;
mode = 2;
break;
off();
}
break;
case(2):
switch(number){
case(1):
writeMatrix(spiral10, 15);
break;
case(2):
writeMatrix(spiral9, 15);
break;
case(3):
writeMatrix(spiral8, 15);
break;
case(4):
writeMatrix(spiral7, 15);
break;
case(5):
writeMatrix(spiral6, 15);
break;
case(6):
writeMatrix(spiral5, 15);
break;
case(7):
writeMatrix(spiral4, 15);
break;
case(8):
writeMatrix(spiral3, 15);
break;
case(9):
writeMatrix(spiral2, 15);
break;
case(10):
writeMatrix(spiral1, 15);
number = 0;
mode = 0;
break;
off();
}
break;
}
}

void writeMatrix(int frame[][3], int time){
for(int j = 0; j < time; j++){
for(int i = 0; i < 3; i++){
digitalWrite(cathode[0], frame[i][0]);
digitalWrite(cathode[1], frame[i][1]);
digitalWrite(cathode[2], frame[i][2]);
digitalWrite(anode[i], HIGH);
delay(1);
digitalWrite(anode[i], LOW);
}
}
}

void off(){
for(int i = 0; i < 3; i++)
digitalWrite(anode[i], LOW);
}```
Some close up the breadboard ans LED matrix.

3

2. What's really cool is my class is learning about the JFETs, BJTs, UJTs etc.

<PvtRyan used Tapatalk to make this Post>

0

3. This is pretty cool! Seems confusing though!

0

4. You've been impressing me lately.

0

5. Kind of interesting

0

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
All times are GMT -10. The time now is 03:38 PM.