[Thanks, Mr. Spolsky for the inspiration here: https://forum.pjrc.com/threads/63231-FastLED-with-Teensy-4-1-fast-parallel-DMA-output-on-any-pin]
Maybe some will find this useful. I've attached a FastLED controller (View attachment CTeensyDMXLEDController.h) that uses DMX to output pixels. Specify the DMX output port and the optional starting channel (minimum 1). (It'll never be perfect, so I forced myself to stop and just attach the thing. )
Here's an example program (I'm using PlatformIO, but the Arduino IDE probably doesn't need to include Arduino.h):
Maybe some will find this useful. I've attached a FastLED controller (View attachment CTeensyDMXLEDController.h) that uses DMX to output pixels. Specify the DMX output port and the optional starting channel (minimum 1). (It'll never be perfect, so I forced myself to stop and just attach the thing. )
Here's an example program (I'm using PlatformIO, but the Arduino IDE probably doesn't need to include Arduino.h):
Code:
#include <Arduino.h>
#include <FastLED.h>
#include "CTeensyDMXLEDController.h"
static constexpr int kNumLEDs = 2; // 2 pixels
CRGB leds[kNumLEDs]; // LED array
CTeensyDMXLEDController<RGB> controller{Serial3}; // TX on Serial3, RGB order
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 4000) {
// Wait for Serial initialization
}
Serial.println("Starting.");
// FastLED initialization; yours may be different
FastLED.setBrightness(255);
FastLED.addLeds(&controller, leds, kNumLEDs); // How to use the controller
}
void loop() {
// Change colours on two pixels once a second
// Your effects loop will be different
leds[0] = CRGB::Red;
leds[1] = CRGB::Green;
FastLED.show();
delay(1000);
leds[0] = CRGB::Green;
leds[1] = CRGB::Blue;
FastLED.show();
delay(1000);
leds[0] = CRGB::Blue;
leds[1] = CRGB::Red;
FastLED.show();
delay(1000);
}