⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁ LED MATRIX 8X8⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁⌁
In this new lesson, we rely simply on what we learned previously.With the addition of a new property in programming .
Electronic parts :
☝ led martrix 8x8 ☝ arduino uno ☝ 2Breadboard ☝ Jumper wires
Learn about the exits of the led Matrix :
We take 1PIN GND and pin 3.3 v And you can Use resistor to protect the led matrix . We attach the PIN to both ends of the Breadboard Positive and negative AND attach the led matrix As shown in the figure :
Now we choose 2 outputs one at the anode and the other on the negative pole of the matrix . If the LED Matrix does not work, invert the poles .
Now we leave the positive wire in its place . but the negative wire We use it to identify the other negative poles of the Matrix LED. Whenever the LED works, this pin is negative . It does not work its meaning between positive.
Matrix LED Columns & Lines Arrangement:
Now we have 8 pin of negative columns.And 8 pin of Positive lines.
We connect all the positive wires to the anode.Then we connect one of the negative wires, to know the arrangement of the lines for the led Matrix, then remove it and select another wire until we are done knowing all the lines.
After this we put all the negative electrodes of the led matrix into the negative electrode.
We do the same to define the order of the columns.
Why do we check columns and lines?
Connect electronic parts :
ROW:
row 1----> Pin 2 ; row 2----> Pin 3 ; row 3----> Pin 4 ; row 4----> Pin 5
row 5----> Pin 6 ; row 6----> Pin 7 ; row 7----> Pin 8 ; row 8----> Pin 9
COLUMN:
column 1----> Pin 10 ; column 2----> Pin 11 ; column 3----> Pin 12 ; column 4----> Pin 13
column 5----> Pin A0 ; column 6----> Pin A1 ; column 7----> Pin A2 ; column 8----> Pin A3
Project Code:
// dimensional array of row pin numbers: int R[] = {2,3,4,5,6,7,8,9}; // dimensional array of column pin numbers: int C[] = {10,11,12,13,A0,A1,A2,A3};
unsigned char biglove[8][8] = //the big "heart"
{
0,0,0,0,0,0,0,0,
0,1,1,0,0,1,1,0,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,0,
0,0,1,1,1,1,0,0,
0,0,0,1,1,0,0,0,
};
unsigned char smalllove[8][8] = //the small "heart"
{
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,1,0,0,1,0,0,
0,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,0,
0,0,1,1,1,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char one[8][8] = //the nbr "1"
{
0,0,0,0,0,0,0,0,
0,0,0,1,1,1,0,0,
0,0,1,1,1,1,0,0,
0,1,1,0,1,1,0,0,
0,0,0,0,1,1,0,0,
0,0,0,0,1,1,0,0,
0,0,0,0,1,1,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char too[8][8] = //the nbr "2"
{
0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,0,
0,0,0,0,0,1,1,0,
0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,0,
0,1,1,0,0,0,0,0,
0,1,1,1,1,1,1,0,
0,0,0,0,0,0,0,0,
};
unsigned char tree[8][8] = //the nbr "3"
{
0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,0,
0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,0,
0,1,1,1,1,1,1,0,
0,0,0,0,0,1,1,0,
0,1,1,1,1,1,1,0,
0,0,0,0,0,0,0,0,
};
unsigned char lovem[8][8] = //the big "broken heart"
{
0,0,0,0,0,0,0,0,
0,1,1,0,0,1,1,0,
1,1,1,0,0,1,1,1,
1,1,1,0,0,1,1,1,
1,1,1,0,0,1,1,1,
0,1,1,0,0,1,1,0,
0,0,1,0,0,1,0,0,
0,0,0,0,0,0,0,0,
};
unsigned char lovey[8][8] = //the "happy face"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,1,0,0,1,0,1,
1,0,0,0,0,0,0,1,
1,0,1,0,0,1,0,1,
1,0,0,1,1,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
unsigned char lovex[8][8] = //the "sad face"
{
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
1,0,1,0,0,1,0,1,
1,0,0,0,0,0,0,1,
1,0,0,1,1,0,0,1,
1,0,1,0,0,1,0,1,
0,1,0,0,0,0,1,0,
0,0,1,1,1,1,0,0,
};
// iterate over the pins:
for(int i = 0;i<8;i++)
// initialize the output pins:
{
pinMode(R[i],OUTPUT);
pinMode(C[i],OUTPUT);
}
} for(int i = 0 ; i < 50 ; i++) //Loop display 50 times { Display(The specified shape); //Display the "The specified shape" }
for(int i = 0 ; i < 100 ; i++) //Loop display 100 times
{
Display(lovey); //Display the "happy face"
} void Display(unsigned char dat[8][8])
{
for(int c = 0; c<8;c++)
{
digitalWrite(C[c],LOW);//use thr column
for(int r = 0;r<8;r++)
{
digitalWrite(R[r],dat[r][c]);
}
delay(1);
Clear(); //Remove empty display light
}
}
void Clear()
{
for(int i = 0;i<8;i++)
{
digitalWrite(R[i],LOW);
digitalWrite(C[i],HIGH);
}
} Full code:
// dimensional array of row pin numbers: int R[] = {2,3,4,5,6,7,8,9}; // dimensional array of column pin numbers: int C[] = {10,11,12,13,A0,A1,A2,A3}; unsigned char biglove[8][8] = //the big "heart" { 0,0,0,0,0,0,0,0, 0,1,1,0,0,1,1,0, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 0,1,1,1,1,1,1,0, 0,0,1,1,1,1,0,0, 0,0,0,1,1,0,0,0, }; unsigned char smalllove[8][8] = //the small "heart" { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,1,0,0,1,0,0, 0,1,1,1,1,1,1,0, 0,1,1,1,1,1,1,0, 0,0,1,1,1,1,0,0, 0,0,0,1,1,0,0,0, 0,0,0,0,0,0,0,0, }; //++++++++++++++++++++++++++++++ unsigned char one[8][8] = //the nbr "1" { 0,0,0,0,0,0,0,0, 0,0,0,1,1,1,0,0, 0,0,1,1,1,1,0,0, 0,1,1,0,1,1,0,0, 0,0,0,0,1,1,0,0, 0,0,0,0,1,1,0,0, 0,0,0,0,1,1,0,0, 0,0,0,0,0,0,0,0, }; unsigned char too[8][8] = //the nbr "2" { 0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,0, 0,0,0,0,0,1,1,0, 0,0,0,0,0,1,1,0, 0,1,1,1,1,1,1,0, 0,1,1,0,0,0,0,0, 0,1,1,1,1,1,1,0, 0,0,0,0,0,0,0,0, }; unsigned char tree[8][8] = //the nbr "3" { 0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,0, 0,0,0,0,0,1,1,0, 0,1,1,1,1,1,1,0, 0,1,1,1,1,1,1,0, 0,0,0,0,0,1,1,0, 0,1,1,1,1,1,1,0, 0,0,0,0,0,0,0,0, }; //+++++++++++++++++++++++++++++ unsigned char lovem[8][8] = //the big "broken heart" { 0,0,0,0,0,0,0,0, 0,1,1,0,0,1,1,0, 1,1,1,0,0,1,1,1, 1,1,1,0,0,1,1,1, 1,1,1,0,0,1,1,1, 0,1,1,0,0,1,1,0, 0,0,1,0,0,1,0,0, 0,0,0,0,0,0,0,0, }; unsigned char lovey[8][8] = //the "happy face" { 0,0,1,1,1,1,0,0, 0,1,0,0,0,0,1,0, 1,0,1,0,0,1,0,1, 1,0,0,0,0,0,0,1, 1,0,1,0,0,1,0,1, 1,0,0,1,1,0,0,1, 0,1,0,0,0,0,1,0, 0,0,1,1,1,1,0,0, }; unsigned char lovex[8][8] = //the "sad face" { 0,0,1,1,1,1,0,0, 0,1,0,0,0,0,1,0, 1,0,1,0,0,1,0,1, 1,0,0,0,0,0,0,1, 1,0,0,1,1,0,0,1, 1,0,1,0,0,1,0,1, 0,1,0,0,0,0,1,0, 0,0,1,1,1,1,0,0, }; void setup() { // iterate over the pins: for(int i = 0;i<8;i++) // initialize the output pins: { pinMode(R[i],OUTPUT); pinMode(C[i],OUTPUT); } } void loop() { for(int i = 0 ; i < 50 ; i++) //Loop display 50 times { Display(one); //Display the "one" } for(int i = 0 ; i < 50 ; i++) //Loop display 50 times { Display(too); //Display the "too" } for(int i = 0 ; i < 50 ; i++) //Loop display 50 times { Display(tree); //Display the "tree" } for(int i = 0 ; i < 100 ; i++) //Loop display 100 times { Display(lovey); //Display the "happy face" } //=================================================================================== for (int j = 0 ; j < 4 ; j++) //The number of iterations of the shape { for(int i = 0 ; i < 100 ; i++) //Loop display 100 times { Display(biglove); //Display the "Big Heart" } for(int i = 0 ; i < 50 ; i++) //Loop display 50 times { Display(smalllove); //Display the "small Heart" } } //=================================================================================== for(int i = 0 ; i < 100 ; i++) //Loop display 100 times { Display(lovem); //Display the "broken heart" } for(int i = 0 ; i < 100 ; i++) //Loop display 100 times { Display(lovex); //Display the "sad face" } } void Display(unsigned char dat[8][8]) { for(int c = 0; c<8;c++) { digitalWrite(C[c],LOW);//use thr column for(int r = 0;r<8;r++) { digitalWrite(R[r],dat[r][c]); } delay(1); Clear(); //Remove empty display light } } void Clear() { for(int i = 0;i<8;i++) { digitalWrite(R[i],LOW); digitalWrite(C[i],HIGH); } }
Important :☝☝☝☝You can add many pieces of led matrix and link them together
This is the test video :


No comments