Using FastLED with VixenLights via UART generic serial port.
#define FASTLED_ALLOW_INTERRUPTS 0
#include <FastLED.h>
#define NUM_LEDS 300
#define DATA_PIN 6
#define serialRate 115200
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(serialRate);
}
void loop() {
int cnt;
unsigned int num_leds;
unsigned int d1, d2, d3;
for(;;) {
cnt = 0;
while(!Serial.available());
if(Serial.read() != '>') {
continue;
}
while(!Serial.available());
if(Serial.read() != '>') {
continue;
}
while(!Serial.available());
d1 = Serial.read();
while(!Serial.available());
d2 = Serial.read();
while(!Serial.available());
d3 = Serial.read();
while(!Serial.available());
if(Serial.read() != '<') {
continue;
}
while(!Serial.available());
if(Serial.read() != '<') {
continue;
}
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
num_leds = (d1-'0')*100+(d2-'0')*10+(d3-'0');
if(num_leds > NUM_LEDS) {
continue;
}
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, num_leds);
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();
}
}
How to setup Vixen https://www.hackster.io/nenitoshouse/how-to-configure-neopixels-using-vixen-lights-and-arduino-527631
http://microcyb.com/fastled_vixen.mp4