I am using the code below, but when I play my few effects on Vixen, no lights light up on my WS2811 string. I am using Arduino Uno connected to pin 6.
The issues I have been dealing with are making sure my baud and serial are the same number: 57600. Putting the header >>050<< in Vixen. Making sure RGB is the same in the code and Vixen. Connecting Vixen first and then connecting Arduino. Making sure the RX button is flashing on Arduino. The Effect Preview in Vixen is on.
The Arduino can run all the canned FastLED programs correctly, so I assume I am doing something wrong in connecting the Arduino and Vixen. I have tried to run the program using only the USB connection to power the WS2811 string, and I have tried it by plugging in an AC/DC adapter 9V, 1500mA into the power jack of the Arduino.
I would greatly appreciate any help. I am undoubtedly missing something basic.
/*
Vixen to Arduino based Generic Serial interface for Addressable Pixels
*/
#include <FastLED.h>
#define NUM_LEDS 050
#define DATA_PIN 6
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
void setup() {
delay(3000);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.clear();
Serial.begin(57600);
}
void loop() {
int cnt;
unsigned int num_leds;
unsigned int d1, d2, d3;
for(;;) {
cnt = 0;
//wait for vixen header
while(!Serial.available());
if(Serial.read() != '>') {
continue;
}
//second char of header
while(!Serial.available());
if(Serial.read() != '>') {
continue;
}
//first digit for the number of pixels
while(!Serial.available());
d1 = Serial.read();
//second digit for the number of pixels
while(!Serial.available());
d2 = Serial.read();
//third digit for the number of pixels
while(!Serial.available());
d3 = Serial.read();
//read til end of the header
while(!Serial.available());
if(Serial.read() != '<') {
continue;
}
while(!Serial.available());
if(Serial.read() != '<') {
continue;
}
// calculate number of pixels from the characters provided in the header digits
num_leds = (d1-'0')*100 + (d2-'0')*10 + (d3-'0');
// if requested number of pixels exceeds connected pixels, ignore.
if(num_leds > NUM_LEDS) {
continue;
}
do {
while(!Serial.available());
leds[cnt].r = Serial.read();
while(!Serial.available());
leds[cnt].g = Serial.read();
while(!Serial.available());
leds[cnt++].b = Serial.read();
}
while(--num_leds);
FastLED.show();
}
}