Control via serial led matrix 8x8

Hello! This is my first post at that forum. I using Arduino about 3 years, and have some experience with it.

I have problem with control via serial console led matrix 8x8 connected do MAX7219 chip. My code is:

#include "LedControl.h"

LedControl lc=LedControl(12,11,10,1);

void setup() {
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,3);
  /* and clear the display */
  lc.clearDisplay(0);
  
  Serial.begin(115200);
  Serial.println("Matrix has you!");
}

void loop() { 
  byte c;
  if (Serial.available()) {
        // read the incoming byte:
        c = Serial.read();
                lc.setRow(0,c, B11111111);
    }
}

Using console i want to enable selected row on display. What is wrong in ma code ? Thanks!

arteqw: Using console i want to enable selected row on display. What is wrong in ma code ?

A few questions:

  • Does the function lc.setRow() do what you expect?
  • What kind of data are you sending to the Arduino? Are you typing the keys labelled 0 to 8 to achieve a result or are you sending data via a program? If it's a the first case, try: lc.setRow(0,c % 8, B11111111);
  • What doesn't work?

Korman

Korman: lc.setRow(0,c % 8, B11111111);

  • What doesn't work?

Thanks, it works! I sending via serial console numbers form 0 to 7.

I just hope you understand why it works and are properly ashamed that with your experience you missed this.

By the way, the code I posted above is a very quick and dirty hack that isn’t fit for production, you should handle the read character properly.

Korman