Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Vixen Lights multiple ws2811 led strings arduino uno

  1. #11
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,797
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    Taking a second look...you should be checking for the headers separately and then retrieving the channel data. The for loop needs to be around the channel data. You will need a different way of checking for headers. You see see how the original sketch you started with uses an empty for. That would be around the headers and data so the continue from not finding headers would go the empty for loop.

    You are headed down the right track. Just needs refinement.

  2. #12
    Join Date
    Jan 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    I do not completly onderstand what you mean saying "use different way of checking for headers"?

    I just brought the Fastled.show() out the for loop and created an endless for loop. As you see in the code below.
    Arduino doesn't give me any error and completes writing the code. When vixen is on the RX led on the arduino reacts.

    Is it possible to give me a small example of code to work with which I can combine with my own code?


    #include <FastLED.h>

    #define NUM_STRIPS 3
    #define NUM_LEDS_PER_STRIP 50
    #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

    CRGB leds[NUM_LEDS];


    void setup() {
    // Define the speed of the serial port
    Serial.begin(115200);

    // tell FastLED there's 50 NEOPIXEL leds on pin 2, starting at index 0 in the led array
    FastLED.addLeds<WS2812B, 2>(leds, 0, NUM_LEDS_PER_STRIP);

    // tell FastLED there's 50 NEOPIXEL leds on pin 3, starting at index 50 in the led array
    FastLED.addLeds<WS2812B, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

    // tell FastLED there's 50 NEOPIXEL leds on pin 4, starting at index 100 in the led array
    FastLED.addLeds<WS2812B, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

    //FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, num_leds);
    }

    void loop() {

    int i = 0;

    for(;;) {
    // for(int i = 0; i < NUM_LEDS; ) {
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //second character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //get the end of the header
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }

    do {
    while(!Serial.available());
    leds[i].r = Serial.read();
    while(!Serial.available());
    leds[i].g = Serial.read();
    while(!Serial.available());
    leds[i].b = Serial.read();
    }
    while(NUM_LEDS);

    i++;

    if(i < NUM_LEDS) {
    continue;
    }
    }

    FastLED.show();

    }

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •