Problem using md_max72xx setrow

#include <MD_MAX72xx.h>                   //  need the library for Max72xx support
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW // don't use PAROLA_HW
#define MAX_DEVICES  8 // 8 displays connected
#define CLK_PIN   13                      // or SCK
#define DATA_PIN  11                      // or MOSI
#define CS_PIN    10                      // or SS
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

void setup()
{                                                        
  randomSeed(analogRead(0));  // set up random generator
  mx.clear();         // clear display
}

void loop()
{
  for (uint8_t row = 0; row <ROW_SIZE; row++) {         
    byte displayRow = random(255);                // random number 
      mx.setRow (row, displayRow);                         // scramble the current row
  }
}

Expected result: gibberish display like old analog TV snow. Actual result: maybe 1 row gets changed then nothing. I think I missed something but Google isn't helping me much. A lot of example I found for using setrow matches what I have except I am using random instead of fixed value. Other examples keeps getting me someone's IoT Christmas lights using LCD. When someone's blog includes a lot of things, it can screw the search results unfortunately.

Ultimately I wanted multiple 8*8 displays scrambled

What did I do wrong?

If you want the whole display scrambled then I would use setColumn() instead and do each column differently.
The way you have it each row in the 8 modules will be identical (ie a repeating pattern). Index from 0 to GetColumnCount()-1 in your loop to cover all the columns.

  • Have you read the library documentation? All these functions in their various forms are explained there.
  • Can you confirm that you tried the examples that come with the library and they work properly with your setup?
  • How are you powering the modules? If it is from the Arduino it will not have enough power for 8 modules. You need to have an external power supply for the modules. Make sure that the grounds are all connected together.

Have you read the library documentation? All these functions in their various forms are explained there.

I tried, the documentation are at times convoluted in their usage like "( uint8_t startDev, uint8_t endDev, uint8_t r, uint8_t value ) without once explaining anywhere what startDev, endDev, r and value. I often understand better by picking apart sketches than trying to read documentation

Can you confirm that you tried the examples that come with the library and they work properly with your setup?

When I used example sketches that came with md_max72xx libraries, they worked fine. It''s my sketch that was missing something.

How are you powering the modules? If it is from the Arduino it will not have enough power for 8 modules. You need to have an external power supply for the modules. Make sure that the grounds are all connected together.

external power, I was also experimenting with 5v relay shield, and those takes too much power for USB power connection. The relay shield was working fine as well, just the LED display was refusing to do what I commanded.

I found the problem, I needed to add a line "mx.begin();" in the setup to actually start the display. Otherwise it'd just do nothing except maybe display one change. And I changed from row to column as you suggested. Now my display works as I wanted.

Good to hear that you got this working.

Here is the documentation entry for the setRow() method you quoted:

Set all LEDs in a row to a new state on contiguous subset of devices.

This method operates on a contiguous subset of devices, setting the value of the LEDs in the row to the specified value bit field. The method is useful for drawing patterns and lines horizontally across specific devices only. endDev must be greater than or equal to startDev. The least significant bit of the value is the lowest column number.

Parameters
startDev	the first device for the transformation [0..getDeviceCount()-1]
endDev	the last device for the transformation [0..getDeviceCount()-1]
r	row which is to be set [0..ROW_SIZE-1].
value	each bit set to 1 will light up the corresponding LED on each device.
Returns
false if parameter errors, true otherwise.

It clearly defines the terms you say are not defined, but I would be curious as to how you think this could be made less 'convoluted'?