LED Matrix WS2812B übereinander schalten

Hallo zusammen,
ich habe zwei der LED Matrizes hintereinander geschaltet. Wenn ich die nebeneinander lege (also 8x 64 Pixel), läuft der Standard NeoPixel Matrixtest hintereinander. Wie modifiziere ich den Code, dass die beiden Matrizes übereinander (also 16 x 32 Pixel) liegen?

Hier die klassische 8x32px Matrix zur Ansicht: https://m.media-amazon.com/images/I/71CX41ui8mL._AC_SX466_.jpg

// Adafruit_NeoMatrix example for single NeoPixel Shield.
// Scrolls 'Howdy' across the matrix in a portrait (vertical) orientation.

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
 #define PSTR // Make Arduino Due happy
#endif

#define PIN 3

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_GRBW    Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)


// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(64, 8, PIN,
  NEO_MATRIX_TOP     + NEO_MATRIX_LEFT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
  NEO_GRB            + NEO_KHZ800);

const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };

void setup() {
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(40);
  matrix.setTextColor(colors[0]);
}

int x    = matrix.width();
int pass = 0;

void loop() {
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);
  matrix.print(F("<-- Gewinner <-- Gewinner <-- Gewinner"));
  if(--x < -270) {
    x = matrix.width();
    if(++pass >= 3) pass = 0;
    matrix.setTextColor(colors[pass]);
  }
  matrix.show();
  delay(100);
}

Meinst du das?

?

Nein, ich meine statt 2 Stück 32x8px (BxH) nebeneinander, die beiden Module untereinander, sodass es ein "Display" mit 32x16px wird.

Wenn ich die Zeile
"Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(64, 8, ..." auf
"Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 16, ..." anpasse, versteht Arduino noch nicht, dass die beiden Module übereinander liegen, weil die Matrizes per Stecker hintereinander geschaltet sind.

Naja, das ist nicht verwunderlich, denn die Adressierung entspricht ja nicht einem Modul.

Was Du versuchen könntest:
Adafruit_NeoMatrix matrix0 = Adafruit_NeoMatrix(64, 8,
Adafruit_NeoMatrix matrix1 = Adafruit_NeoMatrix(64, 8,
Dann aber auch eigenen Zeichensatz schreiben, der auf beiden Displays anzeigt.

Dafür ist "Parameter 4" zuständig.

Einfach probieren, es kann ja nichts kaputt gehen :slightly_smiling_face:

Ne, damit funktioniert es leider nicht. Damit wird nur die "Richtung" des Texts angegeben, z.B. spiegelverkehrt.
Ich möchte dem Arduino ja quasi sagen, wie die Elemente angeordnet sind, z.B. 3 Elemente untereinander oder 3 Elemente nebeneinander..

Seite 50 ff.
Adafruit_1426_eng_tds.pdf (3,4 MB)
Im Original Seitenweise zu lesen: https://learn.adafruit.com/adafruit-neopixel-uberguide/neomatrix-library

1 Like

yes, das meinte ich. Vielen Dank :slight_smile:

Bei der Anordnung unbedingt auf den ersten Pixel achten - der sitzt unterschiedlich, wenn ich die Doku richtig verstanden habe.
Und die Nachwelt freut sich, wenn das funktioniert, wenn das Thema als gelöst markiert ist :wink:

Und ich würde mich über ein funktionierendes Beispiel freuen!

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