Thank you for your reply, Grumpy_Mike.
I agree; I'm actually just going to get a DMX NeoPixel Controller specifically built for this.
But as a learning experience in Arduino I did continue tinkering with this project, and implemented the fixes you mentioned in your last post. Working with only one LED, the code (shown below) works well:
#include <Conceptinetics.h>
#include <Adafruit_NeoPixel.h>
//define NeoPixel Pin and Number of LEDs
#define PIN 8
#define NUM_LEDS 1
//create a NeoPixel strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
// The slave device will use a block of 3 channels counting from
// its start address.
#define DMX_SLAVE_CHANNELS 3
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );
int oldDMX1 = 0;
int oldDMX2 = 0;
int oldDMX3 = 0;
int NEW = 0;
const int LED = 13;
void setup() {
// start the strip and blank it out
strip.begin();
strip.show();
dmx_slave.enable ();
// Set start address to 1
dmx_slave.setStartAddress (1);
pinMode (LED, OUTPUT );
}
void loop()
{
if (dmx_slave.getChannelValue (1) != oldDMX1 || dmx_slave.getChannelValue (2) != oldDMX2 || dmx_slave.getChannelValue (3) != oldDMX3) {
oldDMX1 = dmx_slave.getChannelValue (1);
oldDMX2 = dmx_slave.getChannelValue (2);
oldDMX3 = dmx_slave.getChannelValue (3);
strip.setPixelColor(0, dmx_slave.getChannelValue (1), dmx_slave.getChannelValue (2), dmx_slave.getChannelValue (3));
NEW = 1;
digitalWrite(LED, HIGH);
}
else {
digitalWrite(LED, LOW);
}
if (NEW = 1) {
strip.show();
NEW = 0;
}
delay(10);
}
However when I try to expand the code (shown below) for the entire strip it seems that the Arduino thinks the values are different, even when theyre not (the Status LED I programmed in to turn on with a change and turn off if there is not a change stays on constantly)...
#include <Conceptinetics.h>
#include <Adafruit_NeoPixel.h>
//define NeoPixel Pin and Number of LEDs
#define PIN 8
#define NUM_LEDS 46
//create a NeoPixel strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
// The slave device will use a block of 138 channels counting from
// its start address.
#define DMX_SLAVE_CHANNELS 138
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );
const int FIX[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45
};
const int DMX[] = {1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136
};
int oldR[] = {
};
int oldG[] = {
};
int oldB[] = {
};
int New = 0;
int count = 0;
const int LED = 13;
void setup() {
// start the strip and blank it out
strip.begin();
strip.show();
dmx_slave.enable ();
// Set start address to 1
dmx_slave.setStartAddress (1);
pinMode (LED, OUTPUT );
}
void loop()
{
for (count = 0; count < 46; count++) {
if (dmx_slave.getChannelValue (DMX[count]) != OldR[count] || dmx_slave.getChannelValue (DMX[count] + 1) != OldG[count] || dmx_slave.getChannelValue (DMX[count] + 2) != (OldB[count])) {
OldR[count] = dmx_slave.getChannelValue (DMX[count]);
OldG[count] = dmx_slave.getChannelValue (DMX[count] + 1);
OldB[count] = dmx_slave.getChannelValue (DMX[count] + 2);
strip.setPixelColor(FIX[count], dmx_slave.getChannelValue (DMX[count]), dmx_slave.getChannelValue (DMX[count] + 1), dmx_slave.getChannelValue (DMX[count] + 2));
New = 1;
}
}
for (count = 45; count >= 0; count--) {
if (dmx_slave.getChannelValue (DMX[count]) != OldR[count] || dmx_slave.getChannelValue (DMX[count] + 1) != OldG[count] || dmx_slave.getChannelValue (DMX[count] + 2) != (OldB[count])) {
OldR[count] = dmx_slave.getChannelValue (DMX[count]);
OldG[count] = dmx_slave.getChannelValue (DMX[count] + 1);
OldB[count] = dmx_slave.getChannelValue (DMX[count] + 2);
strip.setPixelColor(FIX[count], dmx_slave.getChannelValue (DMX[count]), dmx_slave.getChannelValue (DMX[count] + 1), dmx_slave.getChannelValue (DMX[count] + 2));
New = 1;
}
}
if (New = 1) {
strip.show();
digitalWrite(LED, HIGH);
New = 0;
}
else {
digitalWrite(LED, LOW);
}
delay(10);
}