Results 1 to 4 of 4

Thread: arduino mega using multiple strips ws2812 vixen 3 cant figure out

  1. #1
    Junior Elf member
    Join Date
    Nov 2018
    Location
    Surrey B.C. Canada
    Posts
    8

    arduino mega using multiple strips ws2812 vixen 3 cant figure out

    Hi people. I started my christmas light project a month ago i made my 16ch relay and arduino it works good . Now i want to add 6 led strip ws2812 50leds each total of 300leds. I am going to use another arduino for my 6 led strip coz i dont think combining my 16ch relay and 6 led strip will work. Now i downloaded fastled library and tested my led strips using sample sketches, and it works. Now i am trying to figure out how am i gonna set it up with Vixen 3 to controll my 6 led strip. I already did all the work in Vixen i made a MEGATREE element for my 6 led strips and change the color handle to (they can be any color, they are full RGB mix to make any color)
    Now i have a total patch points of 900 (300leds x 3 = 900 ) I then made an output of 900 using a Generic Serial controller, I then patch the LED strip . In serial port settings COM3/ 115200baudrate/ NONE/8/ONE
    send a text header >>300<< thenclick ok .
    In my arduino program i have the same 115200 Baudrate,. i tried using this code i got from other website and didnt work.

    /*

    Vixen Lights 3.x - Arduino Generic Serial for Addressable Pixels

    Using this code is pretty straight forward, simply hookup your one wire (WS2811 or WS2812) data line to pin 6 of your Arduino
    and upload this code. Make sure you have properly installed the FastLED library from http://fastled.io Once you are done, simply
    power your Pixel strips from an external power supply. Next configure a Generic Serial Controller inside of Vixen Lights 3.x and
    add 3 x pixels for the number of channels. Configure the Generic Serial Controller to use 115200, 8, none, and 1. Then create
    your element and add "Multiple Items (1 x number of pixels). Finally select your pixel elements and set them as RGB pixels before
    patching them to the controler outputs. You should now be ready to begin testing.

    For a complete tutorial check out blog.huntgang.com

    Created November 8th, 2014
    By Richard Sloan - www.themindfactory.com
    And David Hunt - blog.huntgang.com
    Version 1.4

    */


    // You must download and install the library from http://fastled.io/
    #include <FastLED.h>

    // Sets the maximum number of LEDs that this code will handle to avoid running out of memory
    #define NUM_LEDS 300

    // Sets the pin which is used to connect to the LED pixel strip

    #define NUM_LEDS_PER_STRIP 50
    CRGB Strip1[NUM_LEDS_PER_STRIP];
    CRGB Strip2[NUM_LEDS_PER_STRIP];
    CRGB Strip3[NUM_LEDS_PER_STRIP];
    CRGB Strip4[NUM_LEDS_PER_STRIP];
    CRGB Strip5[NUM_LEDS_PER_STRIP];
    CRGB Strip6[NUM_LEDS_PER_STRIP];




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

    }

    void loop() {
    // Set some counter / temporary storage variables
    int cnt;
    unsigned int num_leds;
    unsigned int d1, d2, d3;

    // Begin an endless loop to receive and process serial data
    for(; {
    // Set a counter to 0. This couter keeps track of the pixel colors received.
    cnt = 0;
    //Begin waiting for the header to be received on the serial bus
    //1st character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //second character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //get the first digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d1 = Serial.read();
    //get the second digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d2 = Serial.read();
    //get the third digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d3 = Serial.read();
    //get the end of the header
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    // calculate the number of pixels based on the characters provided in the header digits
    num_leds = (d1-'0')*100+(d2-'0')*10+(d3-'0');
    // ensure the number of pixels does not exceed the number allowed
    if(num_leds > NUM_LEDS) {
    continue;
    }
    // Let the FastLED library know how many pixels we will be addressing
    FastLED.addLeds<WS2812B, 22>(Strip1, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, 23>(Strip2, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, 24>(Strip3, NUM_LEDS_PER_STRIP);
    // tell FastLED there's 77 WS2812B leds on pin 10
    FastLED.addLeds<WS2812B, 25>(Strip4, NUM_LEDS_PER_STRIP);
    // tell FastLED there's 77 WS2812B leds on pin 11
    FastLED.addLeds<WS2812B, 26>(Strip5, NUM_LEDS_PER_STRIP);
    // tell FastLED there's 77 WS2812B leds on pin 12
    FastLED.addLeds<WS2812B, 27>(Strip6, NUM_LEDS_PER_STRIP);
    // Loop through each of the pixels and read the values for each color
    do {
    while(!Serial.available());
    Strip1[cnt].r = Serial.read();
    Strip2[cnt].r = Serial.read();
    Strip3[cnt].r = Serial.read();
    Strip4[cnt].r = Serial.read();
    Strip5[cnt].r = Serial.read();
    Strip6[cnt].r = Serial.read();
    while(!Serial.available());
    Strip1[cnt].g = Serial.read();
    Strip2[cnt].g = Serial.read();
    Strip3[cnt].g = Serial.read();
    Strip4[cnt].g = Serial.read();
    Strip5[cnt].g = Serial.read();
    Strip6[cnt].g = Serial.read();
    while(!Serial.available());
    Strip1[cnt++].b = Serial.read();
    Strip2[cnt++].b = Serial.read();
    Strip3[cnt++].b = Serial.read();
    Strip4[cnt++].b = Serial.read();
    Strip5[cnt++].b = Serial.read();
    Strip6[cnt++].b = Serial.read();
    }
    while(--num_leds);
    // Tell the FastLED Library it is time to update the strip of pixels
    FastLED.show();
    // WOO HOO... We are all done and are ready to start over again!
    }
    }

  2. #2
    Junior Elf member
    Join Date
    Nov 2018
    Location
    Surrey B.C. Canada
    Posts
    8
    all my connections are good coz i tested it with sample sketch. i have 5v 60A supply. i just need the right code. christmas is comming really need it so bad

  3. #3
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    845
    the data will be sent rgbrbgrbgrbgrbgrbg, not rrrrrrggggggbbbbbb. you want each strip to do something different or you want them to do all the same?

  4. #4
    Senior Elf member
    Join Date
    Jul 2013
    Location
    vinal St. Hudson MA
    Posts
    186
    That code has little chance of working. While you are occasionally waiting for data to show up on the serial interface, once you get one byte you try to read multiple bytes, even if the extra bytes have not been received yet. Since you are using a fixed number of pixels, you should move the output configuration into the setup section and only do it once.

Tags for this Thread

Posting Permissions

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