johnwasser:
Perhaps you mean:
strip1.Color(0, DMXSerial.read(1), 0, 0);
or
byte red = DMXSerial.read(1);
strip1.Color(0, red, 0, 0);
Ah, totally makes sense now that i see it! Thanks!
MarkT:
Post your sketch... snippets are not enough. Explain what it is supposed to do, and what its actually doing, then there's something to go on for suggesting fixes and improvments
#include <DMXSerial.h>
#include <Adafruit_NeoPixel.h>
#define PIXEL_COUNT_OUTPUT1 60
#define PIXEL_PIN 9
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(PIXEL_COUNT_OUTPUT1, PIXEL_PIN,NEO_GRB + NEO_KHZ800); //Information about the Neopixelstrip.
void setup () {
DMXSerial.init(DMXReceiver);
pinMode(PIXEL_PIN, OUTPUT); // sets the digital pin as output
strip1.begin(); //Start sending.
strip1.clear();
strip1.show(); //All pixels at 0.
}
void loop() {
uint32_t red = strip1.Color(255, 0, 0);
uint32_t green = strip1.Color(0, 255, 0);
uint32_t blue = strip1.Color(0, 0, 255);
uint32_t none = strip1.Color(0, 0, 0); //Just some default colors for easy access.
/*strip1.setPixelColor(0, red);
strip1.setPixelColor(1, red);
strip1.setPixelColor(2, red);
strip1.setPixelColor(3, red);
strip1.show();*/
// Calculate how long no data backet was received
unsigned long lastPacket = DMXSerial.noDataSince();
if (lastPacket < 5000) {
// read recent DMX values and set values.
strip1.Color(0, DMXSerial.read(1), DMXSerial.read(2), DMXSerial.read(3)); //Read DMX Address 1(red), 2(green), 3(blue) at pixel 1.
strip1.show(); //Send to pixels.
} else {
// Show red on 3 first pixels when no data was received since 5 seconds or more.
strip1.Color(0 + 1 + 2, 255, 0, 0);
strip1.show();
}
}
Tried to explain the best that i could in the comments, but the idea is to read DMX data on pin 0 and control the neopixel pixel by pixel with the values from dmx. Right now nothing happens. Not even the ELSE statement at the end.