2 row 2 strip array fill/swipe and hold help

I am looking for example code or guidance on what or how to code for my animation.

I have a project to create an animation behind a hole pattern that looks flows from front to rear with the first and/or second LED to lead a fill pattern that is 50% brightness as the first.

I have 2 rows, 18 WS2112B LEDs each (2 separate strips with 2 different pins) that I want to control.
I tried to use TinkerCad, WOKWI and others but still cannot get what I am looking for. I can get a comet, comet wipe, theater chase but do not know how to get what I am looking for.

I want the starting LED(s) to lead a swipe that holds the LEDs at 50% brightness when the starting LEDs goto the end of the strips.

I would also like to have another animation with the animation flowing from the bottom right LED to the top left LED.

I can share a video of the animation(s) that I am looking to achieve.
I am not looking for someone to write the code but to share any similar animations. I am new to Arduino coding and have only tested the example libraries of FastLED, FadeLED, Adafruit and NeoPixel.

Any help is greatly appreciated.

Ask the moerator to move your question to the "Project Guidance" forum. You won't find an answer here.

Thank you for the comment. How do I contact the moderator? through the contact us link on the bottom of the page?

What have you tried? How do some of the FastLED examples differ from what you are trying to achieve?

It may be easier to have all your LEDs in a single strip and just program different sections of the strip to make it "appear" like 2 separate strips.

The examples in the library do a full color wipe and the fades are like breathing bright, low, bright.

I am looking for the fade to happen after the first column of LEDs light, then create the fill and stay at 50% brightness.

There are several patterns requested but I feel if I get one pattern working I can tinker with the others as I learn.
For proof of concept I am using 2 rows of WS2812B and want to flow from right to left. also I would like to be able to turn the bottom row on 100% brightness, then go 50% while the top row goes 100% to have a bottom to top wave.

I am hoping for a white flow, starting 100% brightness and trailing 50% and held when fill is complete.

The final mock up will be similar to image of the PCB with numbered LEDs shown. So the lighting flow would go from right to left with a bright wave front and the trailing LEDs to be 50% brightness and stay on when the 1st LEDs go away.

Well, start with one of the examples that is close to what you want or does part of what you want and add it to. Post your code (read the topic at the top of the forum about how to successfully do that) and then explain what it is doing vs. what you would like it to do and people will assist.

I created new code (removed what I found to be unnecessary).
I am hoping to understand what function(s) determine;
color, intensity, speed and LED positions and how to reverse the directions.

I would like to have the first 2 LEDs in the first column to illuminate with the others trailing behind at 50% brightness and staying when they are all filled.

Then to have a break that turns the LEDs black then to start another loop.
I would like to use CRGB color coding instead of the CVSR (it seems too complicated to come up with a color of choice).

There is some detail in the code of other flows that I am trying to create and hopefully by learning the items mentioned above I can come up with additional code.

//===================================================================================================================================================
// flow1 = (100% right to left 1st 2 LEDs then w/50% solid fill to follow and hold)
// flow2 = (100% left to right 1st 2 LEDs then w/50% solid fill to follow and hold)
// flow3 = (100% bottom row w/50% top row -->> 50% bottom row w/100% top row -->> 100% bottom row w/50% top row)
// flow4 = (start at bottom right to top left to look like a roman candle)
//==============

#include "FastLED.h"   //Make sure to install the FastLED library into your Arduino IDE

//The total number of LEDs being used is 36
#define NUM_LEDS 18

// The data pin for the NeoPixel strip is connected to digital Pin 6 on the Arduino
#define TOP_ROW 6
#define BOTTOM_ROW 8


//Initialise the LED array, the LED Hue (ledh) array, and the LED Brightness (ledb) array.
CRGB leds[NUM_LEDS];
byte ledh[NUM_LEDS];
byte ledb[NUM_LEDS];

const int LEDSpeed = 10; //Speed of the LED animation effect. Make sure not to exceed the maxLEDSpeed value.
int maxLEDSpeed = 200;    //Identifies the maximum speed of the LED animation sequence
int LEDposition = 0;     //Identifies the LED position in the strip that the comet is currently at. The maximum position is NUM_LEDS-1  (eg. 143)
int oldPosition = 0;     //Holds the previous position of the comet.

byte hue = 100;            //Stores the Leading LED's hue value (colour)
byte sat = 25;          //Stores the Leading LED's saturation value
byte tailHue = 0;        //Stores the Comet tail hue value

byte hueRange = 0;      //Colour variation of the tail (greater values have greater variation)
byte intensity = 150;    //The default brightness of the leading LED
byte tailbrightness = intensity / 2; //Affects the brightness "/2 means 50%"
int animationDelay = 50;  //The greater the animation delay, the slower the LED sequence. Calculated from LEDSpeed and MaxSpeed.


int flow = 1;     //Used to choose which flow to show (***Don't change this variable***)


//===================================================================================================================================================
// setup() : Is used to initialise the LED strip
//===================================================================================================================================================

void setup() {
  delay(1000);          //Delay for two seconds to power the LEDS before starting the data signal on the Arduino
  FastLED.addLeds<WS2812B, TOP_ROW, GRB>(leds, NUM_LEDS);    //initialise the LED strip
  FastLED.addLeds<WS2812B, BOTTOM_ROW, GRB>(leds, NUM_LEDS);

  selectFlow();             //Select the next flow front
}


//===================================================================================================================================================
// loop() :
//===================================================================================================================================================
void loop() {
  showLED(LEDposition, hue, sat, intensity);

  //Adjust the hue of the tail so that it is a different colour from the leading LED. To reduce variation in tail colour, reduce the hueRange.
  if (hue > (0 - hueRange)) {
    tailHue = ((hue - hueRange), hue);
  }

  leds[LEDposition] = CHSV((tailHue), sat, tailbrightness); //Set the colour, saturation and brightness of the trailing LED
  setDelay(LEDSpeed);

  LEDposition++;
  if (LEDposition > (NUM_LEDS )) {

    for (int i = 0; i < 50; i++) {
      showLED(LEDposition, hue, sat, intensity);
      setDelay(LEDSpeed);
    }
    LEDposition = 0;
  }
}


//===================================================================================================================================================
// showLED() : is used to illuminate the LEDs
//===================================================================================================================================================
void showLED(int pos, byte LEDhue, byte LEDsat, byte LEDbright) {
  leds[pos] = CHSV(LEDhue, LEDsat, LEDbright);
  FastLED.show();
}

//===================================================================================================================================================
// setDelay() : is where the speed of the LED animation sequence is controlled. The speed of the animation is controlled by the LEDSpeed variable.
//              and cannot go faster than the maxLEDSpeed variable.
//===================================================================================================================================================

void setDelay(int LSpeed) {
  animationDelay = maxLEDSpeed - abs(LSpeed);
  delay(animationDelay);
}
//===================================================================================================================================================
//  flow1  =  (100% right to left 1st 2 LEDs then w/50% solid fill to follow and hold)
//  flow2  =  (100% left to right 1st 2 LEDs then w/50% solid fill to follow and hold)
//  flow3  =  (100% bottom row w/50% top row -->> 50% bottom row w/100% top row -->> 100% bottom row w/50% top row)
//  flow4  =  (start at bottom right to top left to look like a roman candle)
//====================================================================================

void selectFlow() {
  flow++;
  if (flow = 1) {
    flow = 1;
  }

  switch (flow) {
    case 1:  {   // white flow
        hue = 100;
        sat = 20;
        hueRange = 0;
        break;
     }
  }
}



There is lots of documentation of the FastLED library with respect to color. https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors

If you want your pattern to reverse, you will have to count up and then count down with your LEDposition variable.

Also, your leds indices go from 0..NUM_LEDS-1 so this line goes over by 1 (you never want to reach NUM_LEDS)

  if (LEDposition > (NUM_LEDS )) {

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.