Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Created March 2, 2015 16:37
Show Gist options
  • Save hsiboy/7e23ec783d8b2131133f to your computer and use it in GitHub Desktop.
Save hsiboy/7e23ec783d8b2131133f to your computer and use it in GitHub Desktop.
DMX control of neopixels, WS2811, WS2812 etc using FastLED Arduino Teensy3.1
#include <DmxReceiver.h>
#include <FastLED.h>
#define DMX_NUM_CHANNELS 15
#define NUM_LEDS 15
#define DATA_PIN 11
#define LED_TYPE WS2811
#define COLOUR_ORDER
#define CLOCK_PIN 13 // Clock pin only needed for SPI based chipsets when not using hardware SPI
CRGB leds[NUM_LEDS];
DmxReceiver myDMX = DmxReceiver();
volatile unsigned char dmx_data[DMX_NUM_CHANNELS];
volatile unsigned char data;
void setup(void) {
#ifdef USE_SERIAL
Serial.begin(115200);
#endif
FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOUR_ORDER>(leds, NUM_LEDS);
}
void loop(){
#ifdef USE_SERIAL
if (Serial.available()){
handleInput(Serial.read());
}
#endif
DMX.bufferService();
if (DMX.newFrame()) {
for(int i=1; i < DMX_NUM_CHANNELS; i++){
dmx_data[i] = dmx_getDimmer(i);
}
for(int i=0; i < NUM_LEDS; i++) {
leds[i].setRGB( dmx_data[i], 0,0);
}
FastLED.show();
}
}
@bnolan
Copy link

bnolan commented Mar 12, 2016

Hey awesome, have you used this in a show, did it work well?

@ChrisLaurie
Copy link

I have tried this and I cannot get it to display anything. In fact I'm here because I think that dmxReceiver is incompatible with FastLED when driving WS2801 pixels.

@nitbeat
Copy link

nitbeat commented Apr 9, 2017

Hello,

Will this code allows to use DMX software to output DMX to USB to Arduino and then control a stripe of WS2812 LEDS ?

thanks

@netmindz
Copy link

Which DmxReceiver library are you using?

@Killerdom
Copy link

Hi can you tell me where I can downloden the libary please

@Vengateshve
Copy link

How to drive ws2811 from dmx file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment