Well, it looks you're the first one (here) that is thinking of this effect - cool though, we like new effects 😁
And ... nothing wrong with your English - wait until you hear my French haha 😊
Just for reference I've placed the existing code for TheaterChase and Strobe, so we do not need to jump back and forth between this topic and the original LED Effects article.
void loop() {
theaterChase(0xff,0,0,50);
}
void theaterChase(byte red, byte green, byte blue, int SpeedDelay) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, red, green, blue); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, 0,0,0); //turn every third pixel off
}
}
}
}
void loop() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
}
void Strobe(byte red, byte green, byte blue, int StrobeCount, int FlashDelay, int EndPause){
for(int j = 0; j < StrobeCount; j++) {
setAll(red,green,blue);
showStrip();
delay(FlashDelay);
setAll(0,0,0);
showStrip();
delay(FlashDelay);
}
delay(EndPause);
}
I have to admit that I'm still not quite sure what you are thinking off, so correct me if I'm wrong:
1) The theaterchase effect runs (as in the video)
2) At certain moments the entire strips flashes on/off white light, and then continues the theaterchase.
Is that correct?
If so then I can see a few ways to accomplish that - I do not have any hardware handy at the moment, so all of this is untested.
You could try it by modifying the existing theaterchase function, where it calls the strobe effect. However, the theaterchase relies on your not modifying the LED colors, which the strobe effect would. So we'd need to make a backup of the LED array, do the strobe effect, and then restore the backup.
A very fast way to make a backup would be with memcpy, which copies a chunk of memory.
We'd need a second CRGB array for that.
memcpy(leds, leds_backup, NUM_LEDS*3);
So this copies a chunk of memory, starting a the start address in memory of the "leds" array.
The amount of data that is being copied = number of leds x the 3 color values (RGB).
And we copy that to the begin address of the leds_backup variable - overwriting whatever is in it.
After showing the strobe we'd of course need to restore the colors, and we do this the same way.
So code could look something like this (assuming I understood the desired LED effect).
Note: untested, I do not have the needed hardware handy.
The new part in the theaterchase function is clearly marked with the asterisks 😊
...
CRGB leds[NUM_LEDS]; // the normal LED array
CRGB leds_backup[NUM_LEDS]; // LED color array for making a backup
...
void theaterChase(byte red, byte green, byte blue, int SpeedDelay) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, red, green, blue); //turn every third pixel on
}
showStrip();
delay(SpeedDelay);
// ************************
// make a backup of the current LED colors
memcpy(leds, leds_backup, NUM_LEDS*3);
// call strobe function - fine tine as needed of course
Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
// restore backup the old LED colors
memcpy(leds_backup, leds, NUM_LEDS*3);
// make the restored colors visible
showStrip;
// ************************
for (int i=0; i < NUM_LEDS; i=i+3) {
setPixel(i+q, 0,0,0); //turn every third pixel off
}
}
}
}
So before going in deeper I'd probably need to understand better what the desired effect is.
Hope this helps ... 😁