Arduino_LED_Matrix should on() only turn on LED and off all the others?

I'm looking at Arduino_LED_Matrix, and I'm looking for a way to write each LED individually.
I naively thought that I could progressively turn the whole matrix on with this:

  while (i <= 95) {
    matrix.on(i++);
    delay(100);
  }

But no. All on() does is turn all off the LED except for the one in parameter.
Is it how it's supposed to work?
EDIT: the LED matrix is the built-in one of the Uno R4 Wifi board.

It should not turn off the other LEDs.

So I guess there might be a mistake in the parts of the code you didn't share.

Here's the whole thing:

#include <Arduino_LED_Matrix.h>
ArduinoLEDMatrix matrix;
int i = 0;

void setup() {
}

void loop() {
  while (i <= 95) {
    matrix.on(i++);
    delay(100);
  }
}

I even tried with '''
matrix.begin();''' in the set-up, but it was worse: the LEDs only flashed shortly onced, instead of being on for the whole 100 ms.

That should always be there.

Have you tried some of the example sketches that are installed with the library? Do they work as expected?

What type of Arduino are you using?
Is it a type with a built in LED matrix, or do you have an external one?

Sorry, I forgot to specify it in the initial post (I edited it). It's indeed the built in matrix of the Uno R4 WiFi.

OK, so now the code is :

#include <Arduino_LED_Matrix.h>
ArduinoLEDMatrix matrix;
int i = 0;

void setup() {
  matrix.begin();
}

void loop() {
  while (i <= 95) {
    matrix.on(i++);
    delay(100);
  }
  i=0;
}

Each LED lights up briefly then is off again.
Examples work, but they are based on frames, not individual LEDS, as far as I know.

You're right, it is frame based. If you want to toggle LEDs, you will probably have to develop your own routines to set/clear pixels in a matrix that you define, then use the 'renderFrame()' call to write your update to the matrix (in your code, you used the default matrix). Have a look at the code:
https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

It's not clear exactly what the 'on()' method does, because the documentation page truncates it to a few letters
https://docs.arduino.cc/tutorials/uno-r4-wifi/led-matrix#api

In fact, if you look at the Game of Life Example, you can see how they used the same method I recommended to turn on and off individual pixels:

        if ((neighboughs == 2) || (neighboughs == 3)) {
          newGrid[y][x] = 1;
        } else {
          newGrid[y][x] = 0;
        }

That is the example you should probably use as your template.

I sympathize, however this is basically flailing around and hoping you'll hit an answer. With fairly high level API like this, it's essential to use the API functions with the right data and in the right way; unfortunately it looks like Arduino has not made that possible without a lot of sleuthing.

NEVER add information to the first post it spoils the narrative of the thread.

What you need to do is to look at this thread where all of this was thrashed out:-
LED matrix on pin blink

1 Like

Well it's actually a flashforward. Like in an episode of Columbo that starts with showing the crime from the beginning.

No, it's more like "The Time Machine" where people and places appear and disappear as the time line changes... :slight_smile: :slight_smile: :slight_smile:

This is not a television show, it is a forum, and a flippant answer like that is very disrespectful, especially when I have pointed you to the code that solves all your questions on this topic.

You might want to look at this How to get the best out of this forum before you proceed any further.

  1. How is editing the original message a problem? If the issue is that it may seem irrelevant you ask for an information I later added, I specified in #6 that I made this edit after you pointed out some info (the board model) was missing.
  2. How to get the best out of this forum doesen't mention that editing a post for clairification is bad practice.
  3. How is editing a post "spoiling a narrative" ??
  4. The link given is a discussion between people who developed the thing. It is not a readable answer for users discovering this board and this library, the latter not having any proper documentation yet.

I see you have lots of free time to argue.

1 Like

Did you even take the trouble to read it properly? From that comment it looks like you didn't.

It tells you why the LED blinks on for a very short time. That is due to using the matrix.begin();. It also gives you code that will turn on one LED fully and with it the reset turn off.

But if you can't understand the information in that thread and how it exactly answers your question then ask specifically about what you don't understand.

However, given your arrogant attitude then I am not sure if I want to help you any more.

For me, it was originally an interesting question and I put a small research effort into it this morning. I had no idea it would end up like this...

In fact I did orginally have sympathy for the OP because it looks like the library is missing a rather important functionality.

Now, I could care less.

2 Likes

Listen, the whole drama comes from the claim that editing a post is bad for reasons unknown.
I have not yet found a reason why in "How to get the best out of this forum"
Also I just received this:

Editor

This badge is granted the first time you edit one of your posts. While you won’t be able to edit your posts forever, editing is encouraged — you can improve the formatting, fix small mistakes, or add anything you missed when you originally posted. Edit to make your posts even better!

So now is it good or bad?

Finally, Arduino is supposed to be rather accessible. The Arduino_LED_Matrix is obviously still a work in progress. By lack of time, I guess. But in this case, don't blame users for being lost (and a bit frustrated).
And you know what? I made a silly comment because I thought "NEVER add information to the first post it spoils the narrative of the thread." looked like a joke itself. Otherwise I added the info that were indeed missing (hardware, whole code).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.