#include "Tlc5940.h"
#define RowOne 2 //Gate of 1.MOSFET which connects to Row "a" (anodes of all LEDs in Row "a")
#define RowTwo 7 //Gate of 2.MOSFET which connects to Row "b" (anodes of all LEDS in Row "b")
#define RowThree 4 //Gate of 3.MOSFET which connects to Row "c" (anodes of all LEDs in Row "c")
#define RowFour 5 //Gate of 4.MOSFET which connects to Row "d" (anodes of all LEDs in Row "d")
#define RowFive 6 //Gate of 5.MOSFET which connects to Row "e" (anodes of all LEDs in Row "e")
#define Ach 0 //defines the "A" column for the tlc5940 -->OUTPUT 0
#define Bch 1 //defines the "B" column for the tlc5940 -->OUTPUT 1
#define Cch 2 //defines the "C" column for the tlc5940 -->OUTPUT 2
#define Dch 3 //defines the "D" column for the tlc5940 -->OUTPUT 3
#define Ech 4 //defines the "E" column for the tlc5940 -->OUTPUT 4
#define Fch 5 //defines the "F" column for the tlc5940 -->OUTPUT 5
#define Gch 6 //defines the "G" column for the tlc5940 -->OUTPUT 6
#define Hch 7 //defines the "H" column for the tlc5940 -->OUTPUT 7
void setup()
{
pinMode(RowOne, OUTPUT); // declare arduino nano pin 8(RowOne) as OUTPUT
pinMode(RowTwo, OUTPUT); // declare arduino nano pin 7(RowTwo) as OUTPUT
pinMode(RowThree, OUTPUT);// declare arduino nano pin 6(RowThree) as OUTPUT
pinMode(RowFour, OUTPUT); // declare arduino nano pin 5(RowFour) as OUTPUT
pinMode(RowFive, OUTPUT); // declare arduino nano pin 4(RowFive) as OUTPUT
Tlc.init(); // configures the arduino to use the tlc5940, be sure to connect the arduino correctly to the tlc
/* ARDUINO TLC5940
13|-> SCLK (pin 25) OUT1 Column "B" |1 28| OUT0 Column "A"
12| OUT2 Column "C" |2 27|-> GND (VPRG)
11|-> SIN (pin 26) OUT3 Column "D" |3 26|-> SIN (pin 11)
10|-> BLANK (pin 23) OUT4 Column "E" |4 25|-> SCLK (pin 13)
9|-> XLAT (pin 24) OUT5 Column "F" |5 24|-> XLAT (pin 9)
8| OUT6 Column "G" |6 23|-> BLANK (pin 10)
7| OUT7 Column "H" |7 22|-> GND
6| OUT8 Column "I" |8 21|-> VCC (+5V)
5| OUT9 Column "J" |9 20|-> 2K Resistor -> GND
4| OUT10 |10 19|-> +5V (DCPRG)
3|-> GSCLK (pin 18) OUT11 |11 18|-> GSCLK (pin 3)
2| OUT12 |12 17|-> SOUT (only used when you want to use more than one tlc5940)
1| OUT13 |13 16|-> XERR (can be used as error report, but not necessary)
0| OUT14 |14 15| OUT15 */
}
void loop(){
// waits until RowDuration is reached and than goes through cycle
// updates oldMicros value by adding the micros() with RowDuration
//Eletter1();}//pos1();}
// shows first static picture when count==0, so right at the beginng .
digitalWrite(RowOne, HIGH);
digitalWrite(RowTwo, LOW); // sets RowTwo (pin 7) High (not active)--> Row two OFF
digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
digitalWrite(RowFour, LOW); // sets RowFour (pin 5) High (not active)--> Row four OFF
digitalWrite(RowFive, LOW);
Tlc.set(Ach, 2000);
Tlc.set(Bch, 2000);
Tlc.set(Cch, 2000);
Tlc.update();
Tlc.set(Ach, 0);
Tlc.set(Bch, 0);
Tlc.set(Cch, 0);
delay(5);
digitalWrite(RowOne, LOW);
digitalWrite(RowTwo, HIGH); // sets RowTwo (pin 7) High (not active)--> Row two OFF
digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
digitalWrite(RowFour, LOW); // sets RowFour (pin 5) High (not active)--> Row four OFF
digitalWrite(RowFive, LOW);
Tlc.set(Ach, 2000);
Tlc.update();
Tlc.set(Ach, 0);
delay(5);
digitalWrite(RowOne, LOW);
digitalWrite(RowTwo, LOW); // sets RowTwo (pin 7) High (not active)--> Row two OFF
digitalWrite(RowThree, HIGH); // sets RowThree (pin 6) High (not active)--> Row three OFF
digitalWrite(RowFour, LOW); // sets RowFour (pin 5) High (not active)--> Row four OFF
digitalWrite(RowFive, LOW);
Tlc.set(Ach, 2000);
Tlc.set(Bch, 2000);
Tlc.set(Cch, 2000);
Tlc.update();
Tlc.set(Ach, 0);
Tlc.set(Bch, 0);
Tlc.set(Cch, 0);
delay(5);
digitalWrite(RowOne, LOW);
digitalWrite(RowTwo, LOW); // sets RowTwo (pin 7) High (not active)--> Row two OFF
digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
digitalWrite(RowFour, HIGH); // sets RowFour (pin 5) High (not active)--> Row four OFF
digitalWrite(RowFive, LOW);
Tlc.set(Cch, 2000);
Tlc.update();
Tlc.set(Cch, 0);
delay(5);
digitalWrite(RowOne, LOW);
digitalWrite(RowTwo, LOW); // sets RowTwo (pin 7) High (not active)--> Row two OFF
digitalWrite(RowThree, LOW); // sets RowThree (pin 6) High (not active)--> Row three OFF
digitalWrite(RowFour, LOW); // sets RowFour (pin 5) High (not active)--> Row four OFF
digitalWrite(RowFive, HIGH);
Tlc.set(Ach, 2000);
Tlc.set(Bch, 2000);
Tlc.set(Cch, 2000);
Tlc.update();
Tlc.set(Ach, 0);
Tlc.set(Bch, 0);
Tlc.set(Cch, 0);
delay(5);
// set Da brightness to Bch OUTPUT(OUTPUT 1);
}
I wrote the code for 8x5 led it's work for 3x5 i've tried to make the number of 5 display but it's blinking i change delay and brightness lot's of time but couldnt find to solve this
AAA
AOO(2 led blink here)
AAA
OOA (2 led blink here)
AAA
A's represent the light is stable O's represent blinking
how can i solve that issue ?