Hello everyone,
I am relatively new to the electronics and hope to find an explanation/some tip on the following.
I am using 2 x 4051 multiplexers (one as mux, second - demux) to have access to all 64 led in my LED matrix using only 6 Arduino pins.
My code is running as I wish but there appear some parasite leds. Here is complete code
const int oA = 5;
const int oB = 6;
const int oC = 7;
const int iA = 10;
const int iB = 11;
const int iC = 12;
int pinOuts[3]={oA,oB,oC}; //mux control pins
int pinIns[3]={iA,iB,iC}; //demux control pins
// adresses of columns of Matrix
int ColVol[8][3] = { \
{LOW,LOW,LOW},\
{LOW,LOW,HIGH},\
{LOW,HIGH,LOW},\
{LOW,HIGH,HIGH},\
{HIGH,LOW,LOW},\
{HIGH,LOW,HIGH},\
{HIGH,HIGH,LOW},\
{HIGH,HIGH,HIGH},\
};
// adresses of rows of Matrix
int RowVol[8][3] = { \
{LOW,LOW,LOW},\
{LOW,LOW,HIGH},\
{LOW,HIGH,LOW},\
{LOW,HIGH,HIGH},\
{HIGH,LOW,LOW},\
{HIGH,LOW,HIGH},\
{HIGH,HIGH,LOW},\
{HIGH,HIGH,HIGH},\
};
//sample letter "H"
int H[8][8]= { \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 1, 1, 1, 1, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 0, 1, 0} \
};
void setup() {
for (int f = 0; f < 3; f++) {
pinMode(pinOuts[f],OUTPUT);
pinMode(pinIns[f],OUTPUT);
}
}
void loop() {
for (int i=0; i<8; i++)
{
for (int j=0; j<8; j++)
{
if (H[i][j] == 1)
{
for (int k=0; k<3; k++)
{
digitalWrite( pinOuts[k], RowVol[i][k]);
digitalWrite( pinIns[k], ColVol[j][k]);
}
delay(1);
}
}
}
}
if I don't use delay (1) vertical columns of the letter H have neighbors slightly lit up.
Has someone seen this before?
Any ideas how to have exactly wanted leds on?
Thanks in advance