Open N-E-M-A-N opened 8 years ago
Hi I do a fork of Aarons awesome library to support multiple matrices: https://github.com/Jorgen-VikingGod/LEDMatrix
Or multiple controller (data pins) https://github.com/Jorgen-VikingGod/LEDMatrix#initialize-fastled-multiple-controller
#include <FastLED.h>
#include <FastLED_GFX.h>
#include <LEDMatrix.h>
// declare FastLED (matrix / LED strip)
#define PANEL_1_DATA_PIN 2
#define PANEL_2_DATA_PIN 4
#define PANEL_2_CLOCK_PIN 5
#define PANEL_3_DATA_PIN 8
#define PANEL_3_CLOCK_PIN 9
#define PANEL_4_DATA_PIN 1
// declare matrix
#define MATRIX_WIDTH 16 // width of EACH NEOPIXEL MATRIX (not total display)
#define MATRIX_HEIGHT 16 // height of each matrix
#define MATRIX_TILE_H 4 // number of matrices arranged horizontally
#define MATRIX_TILE_V 1 // number of matrices arranged vertically
#define MATRIX_TYPE (MTX_MATRIX_TOP + MTX_MATRIX_LEFT + MTX_MATRIX_ROWS + MTX_MATRIX_ZIGZAG + MTX_TILE_TOP + MTX_TILE_LEFT + MTX_TILE_ROWS) // matrix layout flags, add together as needed
#define MATRIX_SIZE (MATRIX_WIDTH*MATRIX_HEIGHT)
// create our matrix based on matrix definition
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE, MATRIX_TILE_H, MATRIX_TILE_V> matrix;
void setup() {
// initial FastLED with multiple controller, by using CRGB led source from each matrix panal
// panel 1 (from 0 to 255)
FastLED.addLeds<WS2812B, PANEL_1_DATA_PIN, GRB>(matrix[0], 0, MATRIX_SIZE);
// panel 2 (from 255 to 511)
FastLED.addLeds<APA102, PANEL_2_DATA_PIN, PANEL_2_CLOCK_PIN, RGB>(matrix[0], 1*MATRIX_SIZE, MATRIX_SIZE);
// panel 3 (from 511 to 767)
FastLED.addLeds<SK9822, PANEL_3_DATA_PIN, PANEL_3_CLOCK_PIN, BGR>(matrix[0], 2*MATRIX_SIZE, MATRIX_SIZE);
// panel 4 (from 767 to 1023)
FastLED.addLeds<WS2812B, PANEL_4_DATA_PIN, GRB>(matrix[0], 3*MATRIX_SIZE, MATRIX_SIZE);
FastLED.setBrightness(127);
FastLED.clear(true);
}
I prepare also to use the LEDText library, but not finished yet. Maybe on weekend I have some minutes spare to work on the library port.
Firstly, Jorgen-VikingGod, I did get your message about your fork but have not had a chance to look at your mods as I have been very busy on other projects but I will as soon as I get a chance.
Secondly, N-E-M-A-N, I use the Octo adaptor with most of my LED projects. You just make sure that if you have 256 leds on each pin that you define a matrix of 8 * 256. If the four panels that you want to display LEDText on are arranged around the sides of the cube so that LED 1 on each panel is the lower left corner of each face with the LEDS connected vertically. It is important that these panels are connected to four pins in a row such as 2, 14, 7, 8 with the top panel connected to pin 6. You then treat the matrix like it is 8 wide but 64 high even though you do not use all the pins on the Octo board and the X coordinates go up while the Y ones start on the first face then go around the cube with Y of 32-39 being the top of the cube.
Try:-
// Change the next 6 defines to match your matrix type and size
cLEDMatrix<MATRIX_WIDTH, -MATRIX_HEIGHT, MATRIX_TYPE> leds; cLEDText ScrollingMsg;
const unsigned char TxtDemo[] = { EFFECT_CHAR_RIGHT EFFECT_SCROLL_UP " EXAmpl"};
void setup()
{
FastLED.addLeds
void loop() { if (ScrollingMsg.UpdateText() == -1) ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1); else FastLED.show(); delay(80); }
Hey , I use your LEDText library and would like to be a scrolling over 4 Adafruit WS2812 8x8 LED Pixel Matrix matrices running, each has driven its own pin . I use a Teensy 3.2 and the Octo WS2812 adapter . Unfortunately no one could help me how do you manage to write a text on all 4 if each its own pin has . if you need more info just ask. here is my Code:
`/There Are 5 Matricies build an Cube */
include
include
include
include
define MATRIX_OBEN 20//LED_PIN for Top Matrix
define MATRIX_VORNE 8//LED_PIN for Front Matrix
define MATRIX_RECHTS 7//LED_PIN for Right Matrix
define MATRIX_HINTEN 21//LED_PIN for Back Matrix
define MATRIX_LINKS 6//LED_PIN for Left Matrix
define FARB_REIHENFOLGE GRB// COLOR_ORDER
define LEDTYP WS2812// CHIPSET
define MATRIX_WIDTH 8
define MATRIX_HEIGHT 8
define MATRIX_TYPE VERTICAL_MATRIX
define ANZAHL_LEDS 320//NUM_LED Nummber of Total LED´s
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds; / CRGB ledso[ANZAHL_LEDS/5];// Top Matrix CRGB ledsv[ANZAHL_LEDS/5];// Front Matrix CRGB ledsr[ANZAHL_LEDS/5];// Right Matrix CRGB ledsh[ANZAHL_LEDS/5];// Back Matrix CRGB ledsl[ANZAHL_LEDS/5];// Left Matrix /
cLEDText ScrollingMsg;
const unsigned char TxtDemo[] = { EFFECT_CHAR_LEFT EFFECT_SCROLL_DOWN " EXAmpl"}; void setup() { FastLED.addLeds<LEDTYP, MATRIX_OBEN, FARB_REIHENFOLGE>(ledso, ANZAHL_LEDS/5); FastLED.addLeds<LEDTYP, MATRIX_VORNE, FARB_REIHENFOLGE>(leds[0], leds.Size()); FastLED.addLeds<LEDTYP, MATRIX_RECHTS, FARB_REIHENFOLGE>(leds[0], leds.Size()); FastLED.addLeds<LEDTYP, MATRIX_HINTEN, FARB_REIHENFOLGE>(leds[0], leds.Size()); FastLED.addLeds<LEDTYP, MATRIX_LINKS, FARB_REIHENFOLGE>(leds[0], leds.Size());// now it Shows same on 4 Matricies but i wont 1 text runns around the cube FastLED.setBrightness(30); ScrollingMsg.SetFont(MatriseFontData); ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 0, 0); ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1); ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0x00, 0x00, 0xff); FastLED.clear(true); }
void loop() { if (ScrollingMsg.UpdateText() == -1) ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1); else FastLED.show(); delay(80); }`
Sorry for the bad english .. Google translator is to blame .