Hello! I am trying to connect a 32x8 pixel LED matrix to touchdesigner to send simple animations but I am having issues sending the correct data to the Arduino UNO.
I think the main issue is that I’m sending incorrect/too much data from touchdesigner to the arduino.
This is my matrix
I an using these libraries:
Adafruit_GFX
Adafruit_NeoMatrix
Adafruit_NeoPixel
This is my file - I followed this tutorial and Im trying to “transform” the tutorial from strip to matrix without success.
Im sending a strip of data:
op('arduino').send(str(op('rgb')[0,0]))
And this is how the .ino sketch looks:
#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#define LED_PIN 6
#define LED_COUNT 256 // 32x8 matrix
#define BRIGHTNESS 75
//this is our matrix
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, 6, NEO_MATRIX_TOP + NEO_MATRIX_RIGHT + NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE, NEO_RGB + NEO_KHZ800);
String ledVals = "";
int delim = 0;
int r, g, b;
void setup() {
Serial.begin(115200);
Serial.setTimeout(10);
matrix.begin();
matrix.setBrightness(BRIGHTNESS);
matrix.fillScreen(0);
matrix.show();
}
void loop() {
if (Serial.available() > 0) {
ledVals = Serial.readString();
delim = 0;
for (int i = 0; i < matrix.width() * matrix.height(); i++) {
// Parse Red value
delim = ledVals.indexOf(',');
if (delim == -1) break;
r = ledVals.substring(0, delim).toInt();
ledVals = ledVals.substring(delim + 1);
// Parse Green value
delim = ledVals.indexOf(',');
if (delim == -1) break;
g = ledVals.substring(0, delim).toInt();
ledVals = ledVals.substring(delim + 1);
// Parse Blue value
delim = ledVals.indexOf(',');
if (delim == -1) break;
b = ledVals.substring(0, delim).toInt();
ledVals = ledVals.substring(delim + 1);
matrix.setPixelColor(i, matrix.Color(r, g, b));
}
matrix.show();
}
test_matrixarduino.toe (5.1 KB)