DMXSerial Blinks

I'm working on a DMX lighting project and have it working for the most part. This uses the DMXSerial and FastLED libraries. I'm feeding the DMX signal in to a MAX485 chip to convert it into serial data that's picked up using DMXSerial on the RX pin. It reads the three channels (RGB - 1,2,&3 respectively) just fine. This data is a value between 0-255 based upon the fader.

The issue is that the stream of data seems drop to 0 about once every second on all channels. It's not the input to the RX pin, just the output pin 6. This can been seen in the serial monitor also.

For example:
128
128
128
128
128
0
128
128

Is this a limitation of using the serial interface?

#include <DMXSerial.h>
#include <FastLED.h>

const int OutPin =  6;  // Output pin for RGB data.

// This Example receives the 3 values starting with this channel:
const int startChannel = 0 * 3 + 1;

#define LED_QTY         23      // Number of LEDs in strip
#define BRIGHTNESS      255     // brightness range [0..255]
#define CHIP_SET       WS2812B  // types of RGB LEDs
#define COLOR_CODE      GRB     //sequence of colors in data stream

// Define the array of LEDs
CRGB LEDs[LED_QTY];

void setup() {
  Serial.begin(9600);
  DMXSerial.init(DMXReceiver);
  FastLED.addLeds<CHIP_SET, OutPin, COLOR_CODE>(LEDs, LED_QTY);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 500);
  FastLED.clear();
  //FastLED.show();
  
  // enable outputs
  pinMode(OutPin, OUTPUT); // sets the digital pin as output

}

void loop() {
  // Calculate how long no data bucket was received
  //unsigned long lastPacket = DMXSerial.noDataSince();

  //if (lastPacket < 5000) {
    // read recent DMX values and set levels
    //Serial.print("    Start Channel = ") + Serial.println(startChannel);
    Serial.println(DMXSerial.read(startChannel));
    for (int i = 0; i < LED_QTY; i++)
    LEDs[i] = CRGB(DMXSerial.read(startChannel), DMXSerial.read(startChannel + 1), DMXSerial.read(startChannel + 2));
    FastLED.show();
    
  //} else {
    
  //} // if
}

// End.

Never mind. Adding a small delay after the last Fastled.show() took care of it. Now to clean up the code and add more options to it.

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