8x8 LED Matrix - 14 LEDs not working

Hello,

I followed this tutorial for this display

Link to tutorial.

I couldn't get it to print the letter so I used

{8, 8, B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111111};

to turn on all the LEDs. However, on Column 7 and 8, none of LEDs are working except row 5.

If I switch polarity as given in code, only those LEDs are working. I couldn't fix it so here for advice.

Here's my current code

//http://embed.plnkr.co/3VUsekP3jC5xwSIQDVHx/preview

#define ROW_1 2
#define ROW_2 3
#define ROW_3 4
#define ROW_4 5
#define ROW_5 6
#define ROW_6 7
#define ROW_7 8
#define ROW_8 9

#define COL_1 10
#define COL_2 11
#define COL_3 12
#define COL_4 13
#define COL_5 A0
#define COL_6 A1
#define COL_7 A2
#define COL_8 A3

const byte rows[] = {
    ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8
};

// The display buffer
byte testt[] =  {8, 8, B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111};

void setup() {
    // Open serial port
    Serial.begin(9600);
    
    // Set all used pins to OUTPUT
    // This is very important! If the pins are set to input
    // the display will be very dim.
    for (byte i = 2; i <= 13; i++)
        pinMode(i, OUTPUT);
    pinMode(A0, OUTPUT);
    pinMode(A1, OUTPUT);
    pinMode(A2, OUTPUT);
    pinMode(A3, OUTPUT);
}


void loop() {
  drawScreen(testt);  
}
void  drawScreen(byte buffer2[]){
   
  
 // Turn on each row in series
  for (byte i = 0; i < 8; i++) {
      setColumns(buffer2[i]); // Set columns for this specific row
      
      digitalWrite(rows[i], HIGH);
      delay(2); // Set this to 50 or 100 if you want to see the multiplexing effect!
      digitalWrite(rows[i], LOW);
      
  }
}


void setColumns(byte b) {
    digitalWrite(COL_1, (~b >> 0) & 0x01); // Get the 1st bit: 10000000
    digitalWrite(COL_2, (~b >> 1) & 0x01); // Get the 2nd bit: 01000000
    digitalWrite(COL_3, (~b >> 2) & 0x01); // Get the 3rd bit: 00100000
    digitalWrite(COL_4, (~b >> 3) & 0x01); // Get the 4th bit: 00010000
    digitalWrite(COL_5, (~b >> 4) & 0x01); // Get the 5th bit: 00001000
    digitalWrite(COL_6, (~b >> 5) & 0x01); // Get the 6th bit: 00000100
    digitalWrite(COL_7, (~b >> 6) & 0x01); // Get the 7th bit: 00000010
    digitalWrite(COL_8, (~b >> 7) & 0x01); // Get the 8th bit: 00000001
    
    // If the polarity of your matrix is the opposite of mine
    // remove all the '~' above.
}

Thanks for using code tags. If you had read the forum guidelines in the sticky post, you would also know how to post links correctly, like this.

That is a bad tutorial and should not be followed. It will damage the Arduino or the led matrix.

I recommend you get a max7219 chip to drive the 8x8 matrix. You will also need a 10K resistor, a 0.1uF cap and a 10uF cap.

Try this code, should be work:

int ROW[8] = {0,1,2,3,4,5,6,7}; //pins of rows
int COLOUM[8] = {8,9,10,11,12,13,14,15}; //pins of coulumns

int your_figure_x_y[8][8] =       {{0, 0, 0, 0, 0, 0, 0,0}, //put here your "figure"
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0}                               
                              };                              

void setup() {
for(int c=0; c<8;c++){
pinMode(ROW[c],OUTPUT);
pinMode(COLOUM[c],OUTPUT);
}
}

void loop() {
for(int y=0; y<8;y++){
  for(int x=0; x<8;x++){
   if(your_figure_x_y[y][x] ==1){
   digitalWrite(ROW[y],LOW); 
   digitalWrite(COLOUM[8],HIGH); 
   }
   else{
    digitalWrite(COLOUM[x],LOW); 
 delay(2);
   }
  }
  delay(2);
}

}

as they already told you, don't connect loads to Arduino pins!. Use some transistors or other ic's.

my code is very lazy, but in the pas it worked:
-put your figure in your_figure_x_y[8][8] (like pixels, you put "1" if the pixel is ON or "0" if the pixel is off).
-the output "HIGH" or "low" depends of your tipe of connection (pnp transistor, npn transistor).
-try to changhe delays in to the "for" cycle: the "flicker" depend of this;

if you have any questions, write! :slight_smile:

Try this code, should be work:

No, do not try this code. The problem is not the code, it is the circuit. The circuit will cause damage and no code can stop that.