Home Top Ad

Responsive Ads Here

LED MATRIX 8X8

 ⌁⌁⌁⌁⌁⌁⌁⌁ 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?

   Because the led Matrix is different, not in the same order . As well as to check the burned LEDs.

Connect electronic parts :

   Now we connect the project this way, which in the picture,You can add resistance to protect the matrix.


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:

Identify the ports :
// 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};
Writing numbers and drawings that are programmed
In the form of a matrix With the new addition "unsigned char"That control array operation and prevent interference between Pins .
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,
};
initialize the output pins:
  // iterate over the pins:
  for(int i = 0;i<8;i++)  
  // initialize the output pins:
  {  
    pinMode(R[i],OUTPUT);  
    pinMode(C[i],OUTPUT);  
  }  
}  
The code for numbers and fees on the led Matrix:
In each figure we write the name of the shape and the time in which it stays before it disappears.
       for(int i = 0 ; i < 50 ; i++)         //Loop display 50 times
  {     
    Display(The specified shape);                 //Display the "The specified shape" 
  } 
exmp:
   for(int i = 0 ; i < 100 ; i++)         //Loop display 100 times
  {     
    Display(lovey);                 //Display the "happy face" 
  } 

void Display and void clear :
New addition to control on / off playback for each of the shapes identified.
And we write it after "void loop"
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