Hello, finally completed the assembly of my Xmas tree ! Here's a short video

Hello, finally completed the assembly of my Xmas tree !

Here’s a short video of a very simple test pattern where I turn on every LED red, green and blue sequentially. Now I need to start working on really nice animations.

I am using a 100W 5V PSU powering directly an Arduino Mega and all 332 WS2811 pixel modules with diffused 8mm RGB LEDS. The branches (34 in total) have anywhere from 4 to 13 RGB LEDS and are connected to the trunk by small XH2.54 4-pin connectors making for easy assembly/disassembly and storage.

It may not be considered good coding, but keep in mind that your LED array, even though it is two dimensional, can be referenced as if it were one long single dimension array. You can, for instance, use the memcpy8 function to copy a CRGB variable (which has a length of 3 bytes) into an offset from the beginning of the LED array.

By manually pre-filling an integer array of offsets, you could loop through and set the color for just the triads one pixel at a time.

The “Sparkle” function in the code I previously posted shows another way to fill a pixel when treating the LED array as a flat array:

  *((CRGB *)leds + random8( TTL_LEDS )) = color;

“*((CRGB *)leds” points to the beginning of an array of CRGB objects.
“+ random8( TTL_LEDS ))” adds an offset (again in CRGB units).
“color” is a CRGB variable.

By replacing “random8( TTL_LEDS )” with a value from 0 to 441 (you have 442 elements in your array, you just don’t use some of them) you can plug in a value directly to any pixel.

Hi again @P_Routon , thanks for the hints and sample code.

I changed my sketch from the ‘Array of LED arrays’ type to the more applicable ‘One array, many strips’ as found in the FastLED example of Multiple Controllers.

I am slowly learning the use of offsets as you suggested and making some progress.

I managed to get some nice animations going already based on Mark’s ‘SoftTwinkles’ and ‘ColorTwinkles’ sketches.

Could you post a video or link to your snowflake animations so that I can see what you came up with and possibly select some of them for my own use ?

Thanks again !

I’d love to post some video, but I haven’t got anything with which to take the video, other than an analog Hi-8 video camera and an Olympus C-8080z still camera with VGA level video capture. I’m going to have to see what my roommate’s Motorola RAZR can do.

I also need to modify the code so that it steps through the routines in sequence (as a demo), rather than the current random mode. Access to the Arduino is away from the computer, up a ladder, so I picked up another Uno so that I could just swap them back and forth (and so if I screw up the code I can quickly go back to the working unit).