Spring Sale: 5% OFF Over $89, Code: Elephant5; 10% OFF Over $149, Code:Elephant10



Arduino Project: Displaying Your “0”

Posted by Fiona Su on

thumb

Introduction:
We have introduced 74HC595 shift register last project. Now, we are going to learn 8*8 dot matrix. It consists of 64 LEDs, located in every crossing of each row and column. When a row is at level 1, and a column at level 0 simultaneously, LED lights up that is between high and low level.
For instance, if you want to light up the first LED, connect pin 7 to high level, and pin A to low level; if you want to light up LEDs in first row, connect pin 7 to high level, and pin A, B, C, D, E, F, G, H to low level; if you want to light up LEDs in first column, connect pin A to high level, and pin 0, 1, 2, 3, 4, 5, 6, 7 to low level shown as below figure.
Schematic Diagram:

thumb

Appearance and Matrix Pin:

thumb thumb

8X8 LED matrix has too many pins that Arduino is difficult to interface. This kit shows how to use one interface chip 74HC595 IC to interface Arduino to drive 8X8 LED matrix.
In this project, we will use the matrix to display “0”.

Hardware Required:

  • Arduino Board *1
  • USB Cable *1
  • 74HC595 IC *2
  • LED Matrix*1
  • 220Ω Resistor *8
  • Breadboard*1
  • Breadboard Jumper Wires

Connection for REV4:

thumb

Connection for 2560 R3:
thumb

Sample Code:

//define an array to store “0”
unsigned char Text[]={0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c};
void Draw_point(unsigned char x,unsigned char y)//draw-point function
{
   clear_();
   digitalWrite(x+2, HIGH);
   digitalWrite(y+10, LOW);
   delay(1);
}
void show_num(void)//show function and invoke draw-point function
{
  unsigned char i,j,data;
  for(i=0;i<8;i++)
  {
    data=Text[i];
    for(j=0;j<8;j++)
    {
      if(data & 0x01)Draw_point(j,i);
      data>>=1;
    }  
  }
}
void setup(){ 
int i = 0 ; 
for(i=2;i<18;i++) 
 { 
   pinMode(i, OUTPUT); 
  }  
  clear_(); 
}
void loop()
{ 
  show_num();    
} 
void clear_(void)//clear screen
{
  for(int i=2;i<10;i++)
  digitalWrite(i, LOW);
  for(int i=0;i<8;i++)
  digitalWrite(i+10, HIGH);
}

Result:
After connection and uploading codes, the matrix is displaying your “0”.

0 comments

Leave a comment

Please note, comments must be approved before they are published