I made a 8 column 5 row LED matrix of which I want to use 4 column and 5 row to display a letter ‘A’ I could somehow display the letter but things are not perfect because
- The letter display (or LEDs for letter A) flickers a lot and
- It would display (by flickering ) for few seconds and would remain OFF for the equal amount of time time. I failed to figure out why ?
I am using a IC 74HC595 to multiplex the row and scanning the column as evident from my sketch below.
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
int data[5]={15,20,20,15}; //For Letter A only
void setup()
{
pinMode(latchPin,OUTPUT);
pinMode(clockPin,OUTPUT);
pinMode(dataPin,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
void loop()
{
for(int j=0;j<4;j++)
{
//Scanning Column
if(j==0)
{
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
}
else if(j==1)
{
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
}
else if(j==2)
{
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
}
else if(j==3)
{
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
}
//Providing O/P to Row
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,LSBFIRST,data[j]);
digitalWrite(latchPin,HIGH);
delay(40);
}
}
delay(40) is the best delay I could get to display my letter by still its imperfect.
PS: I searched this forum for similar queries but could not find any