Go Down

Topic: LED screen (Read 793 times) previous topic - next topic


Hi all,
I'm building an LED screen. Right now  it's 3x3. The problem is that I'm trying to make it display some images but it doesn't stop flickering. Does anyone know why is it happening? Here is the code I'm using. I'm receiving a String from processing with the states for each LED on. I added an image of the connections at the end of this post

Thanks in advance.

Code: [Select]
char val;
String data = "";

int pinColumn = 11;
int pinRow = 8;

const int ancho = 3;
const int alto = 3;

int leds[ancho*alto];

int matrizLeds[ancho][alto];
int contador = 0;

int temporal[alto];
char recibido[ancho*alto];

int counter = 0;
void setup()
  for(int i=8; i<15; i++){
    pinMode(i, OUTPUT);
  for(int i=0; i<ancho*alto; i++){
    leds[i]= 0;

void loop()
  if (Serial.available())
    val = Serial.read();
    if (val != 'L')
      recibido[counter] = val;
      leds[counter] = int(recibido[counter]);
      counter = 0;
      contador = 0;
      for(int i=0; i<alto; i++) { // row scan
        for(int j=0; j<ancho; j++) { // column scan
          matrizLeds[i][j] = leds[contador];
          contador ++;

void encenderLeds() {
  for(int i=0; i<ancho; i++) { // row scan
    for(int j=0; j<alto; j++) { // column scan
      if(matrizLeds[i][j] == 49){
        Serial.print("entre i=");
        Serial.print(" j=");
        digitalWrite(i+pinColumn, HIGH);
        digitalWrite(j+pinRow, LOW);
        digitalWrite(i+pinColumn, LOW);
        digitalWrite(j+pinRow, HIGH);


Could the flicker be due to the large amount of slow serial data you're outputting?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


Drop all the printing.
Read this:-
It is what you are trying to do.


Thank you both! I removed the Serial printing and it's now working  :)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131