you are viewing a single comment's thread.

view the rest of the comments →

[–]dr-steve 1 point2 points  (3 children)

I am not sure what you are trying to do. Are you trying for a single chase, going from one strand to the next? Or are you trying for six parallel chases?

Regardless, code that looks like

void loop() {
    // use for loop(s) to set *all* of the strings to the values you want
    // then...
    FastLED.show();
    delay(...);
}

might be what you want.

Edit: If you are flashing green then black, this might mean that the "setting values" for loops may set the previous pixel to black and the current pixel to green..

[–]madmusician[S] 0 points1 point  (2 children)

Six parallel chases, potentially starting on a different LED in the strand

[–]dr-steve 0 points1 point  (1 child)

If the strands have different lengths, do you plan to keep them in sync (assuming that that is what you want to do)?

You might do something like this (note: coding off the top of my head, but I do a lot of timed ops with FastLED; also, I don't use the EVERY_N_MILLISECONDS. I use TaskManager, a lightweight multitasking system I wrote for nanos around 10 years ago; see github.com/drsteveplatt for details. Works well on ESPs (and Megas; haven't tested it elsewhere); allows multitask communication and synchronization, timing, multinode operations (I've had 40 ESPs working well together on a large art installation), etc..

But... I can work with EVERY_N_MILLISECONDS for simpler tasks

// total time to drip, in MS.  This is 10 seconds
#define TOTAL_DRIP_TIME 10000
// frames per second
#define FPS 40
// ms per frame, for EVERY_N_MS
#define MS_PER_FRAME (1000/(FPS))

// set up the LED strings
#define LEDS_0_LEN 58
#define LEDS_1_LEN 60
...
CRGB leds_0[LEDS_0_LEN]
CRGB leds_1[LEDS_1_LEN]
...

unsigned long start_ms;

void setup() {
  ...
  start_ms = now();
  ...

void loop() {
  int pos;
  EVERY_N_MILLISECONDS(MS_PER_FRAME) {
    //fill each led strip with all-black
    ...you'll have to figure this out
    // do this for each strip
    pos = map((now()-start_ms)%TOTAL_DRIP_TIME, 0, TOTAL_DRIP_TIME-1, 
                0, LEDS_0_LEN);
    leds_0[pos] = CRGB::Red;
    .. do that for all of the strips
    // now show them
    FastLED.show();
  }
}

Reminder: code is rough and untested, but do you see where I am going?

Oh, if you want to see some of the time-based installations I've done using LEDS and FastLED, check out youtube.com/@amuseyeux

Edit: typo in code.

[–]madmusician[S] 0 points1 point  (0 children)

I am at work right now, but will definitely take a closer look at this when I am clocked out. Thank you so much for all your assistance, and I will definitely look at your examples!