Hello
I wrote this test code for my led matrix. It works, but there are 2 leds at full brightness and 2 leds at low brightness in the corners. What's the reason?
// Datasheet and ledmatrix I used
//http://www.farnell.com/datasheets/1631380.pdf
//Source: http://www.local-guru.net/blog/2009/04/03/5x7-led-matrix-on-my-arduino
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
---Diagram of led matrix---
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The numbers are the pins of the led matrix. The "O" are the leds.
14 13 12 11 10 9 8
O O O O O
O O O O O
O O O O O
O O O O O
O O O O O
1 2 3 4 5 6 7
%%%%%%%%%%%%
---Wiring---
%%%%%%%%%%%%
This is the syntax:
==> Arduino Digital OUT | MATRIX Pin in (row/column *number*) <==
2|9 (row 1)
3|14 (row 2)
4|8 (row 3)
5|12 OR 5, they're connected! (row 4)
6|1 (row 5)
7|7 (row 6)
8|2 (row 7)
9|13 (col 1)
10|3 (col 2)
11|4 OR 11, they're connected!(col 3)
12|10 (col 4)
13|6 (col 5)
You have to connect for example pin 2 with pin 9 of the led matrix (watch the diagram), that's the second from right
*/
int c1 = 9; //column 1, pin 9 of arduino
int c2 = 10;
int c3 = 11;
int c4 = 12;
int c5 = 13;
int r1 = 2; //row 1, pin 2 of arduino
int r2 = 3;
int r3 = 4;
int r4 = 5;
int r5 = 6;
int r6 = 7;
int r7 = 8;
//%%%%%%%%%%%%
//---Setup---
//%%%%%%%%%%%%
void setup() {
//These are the columns
pinMode( 9, OUTPUT );
pinMode( 10, OUTPUT );
pinMode( 11, OUTPUT );
pinMode( 12, OUTPUT );
pinMode( 13, OUTPUT );
//These are the rows
pinMode( 2, OUTPUT );
pinMode( 3, OUTPUT );
pinMode( 4, OUTPUT );
pinMode( 5, OUTPUT );
pinMode( 6, OUTPUT );
pinMode( 7, OUTPUT );
pinMode( 8, OUTPUT );
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(r1,LOW);
digitalWrite(r2,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(r4,HIGH);
digitalWrite(r5,HIGH);
digitalWrite(r6,HIGH);
digitalWrite(r7,HIGH);
digitalWrite(c1, HIGH);
digitalWrite(c2, LOW);
digitalWrite(c3, LOW);
digitalWrite(c4, LOW);
digitalWrite(c5, LOW);
delay(10);
digitalWrite(r1,HIGH);
digitalWrite(r2,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(r4, LOW);
digitalWrite(r5,HIGH);
digitalWrite(r6,HIGH);
digitalWrite(r7,HIGH);
digitalWrite(c1, LOW);
digitalWrite(c2, LOW);
digitalWrite(c3, HIGH);
digitalWrite(c4, LOW);
digitalWrite(c5, LOW);
delay(10);
}
Kind regards