Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: FASTLED and DmxReceiver.h

  1. #1

    FASTLED and DmxReceiver.h

    i am trying to use DmxReceiver.h and FastLed library together but get this error:


    In file included from teensy_dmx_serial.ino:7:0:
    /Users/pankow/Documents/Arduino1/libraries/FastLED/FastLED.h:21:2: error: 'DMX' redeclared as different kind of symbol
    teensy_dmx_serial:5: error: previous declaration of 'DmxReceiver DMX'

    is there a way around this?

    thanks,
    stephan.

    Code:
    //this works fine for teensy
    
    
    #include <DmxReceiver.h>
    DmxReceiver DMX = DmxReceiver();
    
    #include "FastLED.h"
    
    //#define USE_SERIAL
    
    //int boardLED = 13;
    boolean boardLED_state = true;
    
    
    //---------------------------------------DMX-------------------------------------
    #define DMX_NUM_CHANNELS 15
    
    volatile unsigned char dmx_data[DMX_NUM_CHANNELS];
    volatile unsigned char data;
    
    
    
    //-------------ws2801--------------
    // How many leds are in the strip?
    #define NUM_LEDS 15
    
    // Data pin that led data will be written out over
    #define DATA_PIN 11
    
    // Clock pin only needed for SPI based chipsets when not using hardware SPI
    #define CLOCK_PIN 13
    
    // This is an array of leds.  One item for each led in your strip.
    CRGB leds[NUM_LEDS];
    
    //-----------
    int led_vcc_switchPin = 6;
    boolean led_vcc_on = false;
    
    void setup(void) {
    
      pinMode(led_vcc_switchPin, OUTPUT);
      digitalWrite(led_vcc_switchPin, LOW);
      led_vcc_on = false;
    
      //DMX.begin();
    #ifdef USE_SERIAL
      Serial.begin(115200);
    #endif
    
      FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
    
    }
    
    void loop(){
    
    #ifdef USE_SERIAL
      if (Serial.available()){
        handleInput(Serial.read());
      }
    #endif
    
      if(led_vcc_on == false){
        if(millis() > 2000){
          led_vcc_on = true;
          digitalWrite(led_vcc_switchPin, HIGH);
          // digitalWrite(ledPin, LOW);
        }
      }
    
    
      DMX.bufferService();
    
      if (DMX.newFrame()) {
        for(int i=0; i<DMX_NUM_CHANNELS; i++){
          dmx_data[i] = dmx_getDimmer(i+1);
          //fadeValues[i] = dmx_data[i] 
        }
        for(int i = 0; i < NUM_LEDS; i++) {
          leds[i].setRGB( dmx_data[i], 0,0);
        }
        FastLED.show();
      }
    
    }

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,486
    Fast LED.h declares DMX as an enumeration constant:

    Code:
    enum EClocklessChipsets {
    	DMX,
    	TM1809,
    	TM1804,
    	TM1803,
    	WS2811,
    	WS2812,
    	WS2812B,
    	WS2811_400,
    	NEOPIXEL,
    	UCS1903
    };
    So in your code, you need to change DMX to be another name as a global variable, and in all of the places that refer to it.

  3. #3
    Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Quote Originally Posted by MichaelMeissner View Post
    Fast LED.h declares DMX as an enumeration constant:

    Code:
    enum EClocklessChipsets {
    	DMX,
    	TM1809,
    	TM1804,
    	TM1803,
    	WS2811,
    	WS2812,
    	WS2812B,
    	WS2811_400,
    	NEOPIXEL,
    	UCS1903
    };
    So in your code, you need to change DMX to be another name as a global variable, and in all of the places that refer to it.

    Yeah - I need to go through and move everything into a namespace to scale back on collisions like that.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,332
    You could also change this:

    Code:
    DmxReceiver DMX = DmxReceiver();
    to something like this:

    Code:
    DmxReceiver myDMX = DmxReceiver();
    and then simple replace all the "DMX" name with "myDMX" in that example program. Yes, a bit of extra work, but not difficult.

  5. #5
    thanks that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •