Draw pixels in different columns in RGB panel

Hello,

In the project I’m working on I’m sending numbers from Simulink to Arduino, reading them and then activating the corresponding LEDs. If for example I send the following numbers 1,34,18,45,63,10 I want to activate the LED number 1 of the first column, the LED number 34 of the second column, the LED number 18 of the third column and so on for all the 32 columns.

I used the matrix.drawPixel command but with the code shown below I can only activate those LEDS on the first column. With the current program there is no sequence through the columns.

[code]
//#include <Adafruit_GFX.h>
//#include <Adafruit_MonoOLED.h>
//#include <Adafruit_SPITFT.h>
//#include <Adafruit_SPITFT_Macros.h>
//#include <gfxfont.h>
//#include <gamma.h>
//#include <RGBmatrixPanel.h>

#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
#include <limits.h>

#define CLK 11
#define OE  9
#define LAT 10

#define A   A0
#define B   A1
#define C   A2
#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

int sensorPin1 = A0;
int sensorPin2 = A1;
int sensorPin3 = A2;
int sensorPin4 = A3;

int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
int sensorValue4 = 0;

//File wavedata;
int incomingByte = 0;
int incomingByte1 = 0;
typedef union {
  int num[3];
  uint8_t bytes[3];
} foo;
foo myFoo;
int input;
int i = 0;
char buf[32];


void setup() {
  delay(1000);
  matrix.begin();
  Serial.begin(9600);
  char buf[32];
}
void loop() {
  matrix.fillScreen(matrix.Color333(0, 0, 0));

  if (Serial.available()) {
    int input = Serial.read();

    myFoo.bytes[0] = input;
    incomingByte = myFoo.num[0];


    matrix.drawPixel(incomingByte,i, matrix.Color333(7, 7, 7));
 
  }

  delay(1000);


}

[/code]
I tried to solve the problem with the code below but the those changes in the code did not help. With this second code all the 16 LEDS in the row 1,34,18,45… activate.

[code]
#include <Adafruit_GFX.h>   // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
#include <limits.h>

#define CLK 11
#define OE  9
#define LAT 10

#define A   A0
#define B   A1
#define C   A2
#define D   A3

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

int sensorPin1 = A0;
int sensorPin2 = A1;
int sensorPin3 = A2;
int sensorPin4 = A3;

int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
int sensorValue4 = 0;

//File wavedata;
int incomingByte = 0;
int incomingByte1 = 0;
typedef union {
  int num[3];
  uint8_t bytes[3];
} foo;
foo myFoo;
int input;
int i = 0;
char buf[32];
int col = 0;

void setup() {
  delay(1000);
  matrix.begin();
  Serial.begin(9600);
  char buf[32];
}
void loop() {
  matrix.fillScreen(matrix.Color333(0, 0, 0));

  if (Serial.available()) {
    int input = Serial.read();

    myFoo.bytes[0] = input;
    incomingByte = myFoo.num[0];

 
    matrix.drawPixel(incomingByte, 1, matrix.Color333(7, 7, 7));
    col = 1;

    if (col = 1) {
      matrix.drawPixel(incomingByte, 2, matrix.Color333(7, 7, 7));
      col = 2;
    }
    if (col = 2) {
      matrix.drawPixel(incomingByte, 3, matrix.Color333(7, 7, 7));
      col = 3;
    }
    if (col = 3) {
      matrix.drawPixel(incomingByte, 4, matrix.Color333(7, 7, 7));
      col = 4;
    }
    if (col = 4) {
      matrix.drawPixel(incomingByte, 5, matrix.Color333(7, 7, 7));
      col = 5;
    }
    if (col = 5) {
      matrix.drawPixel(incomingByte, 6, matrix.Color333(7, 7, 7));
      col = 6;
    }
    if (col = 6) {
      matrix.drawPixel(incomingByte, 7, matrix.Color333(7, 7, 7));
      col = 7;
    }
    if  (col = 7) {
      matrix.drawPixel(incomingByte, 8, matrix.Color333(7, 7, 7));
      col = 8;
    }
    if (col = 8) {
      matrix.drawPixel(incomingByte, 9, matrix.Color333(7, 7, 7));
      col = 9;
    }
    if (col = 9) {
      matrix.drawPixel(incomingByte, 10, matrix.Color333(7, 7, 7));
      col = 10;
    }
    if (col = 10) {
      matrix.drawPixel(incomingByte, 11, matrix.Color333(7, 7, 7));
      col = 11;
    }
    if (col = 11) {
      matrix.drawPixel(incomingByte, 12, matrix.Color333(7, 7, 7));
      col = 12;
    }
    if (col = 12) {
      matrix.drawPixel(incomingByte, 13, matrix.Color333(7, 7, 7));
      col = 13;
    }
    if (col = 13) {
      matrix.drawPixel(incomingByte, 14, matrix.Color333(7, 7, 7));
      col = 14;
    }
    if (col = 14) {
      matrix.drawPixel(incomingByte, 15, matrix.Color333(7, 7, 7));
      col = 15;
    }
    if (col = 16) {
      matrix.drawPixel(incomingByte, 16, matrix.Color333(7, 7, 7));
      col = 17;
    }

  }

  delay(1000);


}

[/code]

So, for the moment I can only activate those LED in sequence in the first column, or activate the whole 32 LED row in sequence. Any way of activating the LEDs in sequence in each column?
Thank you

Why not post your schematic, not a frizzy thing so we can help. The hardware has a big impact on the software.

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