Lighting Arduino R4 (WIFI) LEDs individually?

Is there some way to use code, like a for next loop to light a line of LEDs on the R4, or the 8 lines of 12?

Like:


FOR x= 0 to 11;
FOR y= 0 to 7;
 LIGHT LED(x,y);
NEXT y;
Next x;

This pseudocode is only to show that I would rather avoid using frames and making an animation, I want to know if there is a way to control the LEDs with numbers?

https://docs.arduino.cc/tutorials/uno-r4-wifi/led-matrix/

That didn't really state exactly how to do it, and I had read it before, but, I was able to work out from that how to address each LED individually, here is some code that lights them all in a row, then puts them out and repeats:

#include "Arduino_LED_Matrix.h"
ArduinoLEDMatrix matrix;

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

uint8_t frame[8][12] = {
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

void loop()
{
  
  for (int y = 0; y <= 7; y++) {
   for (int x = 0; x <= 11; x++) {
  frame[y][x] = 1;
matrix.renderBitmap(frame, 8, 12);
delay(50);
  };
  };
  for (int y = 0; y <= 7; y++) {
   for (int x = 0; x <= 11; x++) {
  frame[y][x] = 0;
matrix.renderBitmap(frame, 8, 12);
  };
  };
  delay(50);
}
1 Like

Before you copy your code out of the IDE to post it, press control-T. That will autoformat it so it doesn't wander all over and it's easy to read where the blocks of code are.