Camila_99$$
DIIDevHeads IoT Integration Server
•Created by Camila_99$$ on 5/30/2024 in #middleware-and-os
How to Synchronize Two LED Strip Effects to Start Simultaneously?
#include <FastLED.h>
#define NUM_LEDS_BAND1 132
#define NUM_LEDS_BAND2 96
#define DATA_PIN_BAND1 2
#define DATA_PIN_BAND2 3
CRGB leds_band1[NUM_LEDS_BAND1];
CRGB leds_band2[NUM_LEDS_BAND2];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN_BAND1, RGB>(leds_band1, NUM_LEDS_BAND1);
FastLED.addLeds<WS2812B, DATA_PIN_BAND2, RGB>(leds_band2, NUM_LEDS_BAND2);
}
void loop() {
idle(leds_band1, NUM_LEDS_BAND1, leds_band2, NUM_LEDS_BAND2);
chenillard(leds_band1, NUM_LEDS_BAND1, leds_band2, NUM_LEDS_BAND2);
}
void idle(CRGB leds1[], int numLEDs1, CRGB leds2[], int numLEDs2) {
for (int brightness = 0; brightness <= 51; brightness++) {
FastLED.setBrightness(brightness);
for (int i = 0; i < 59; i++) {
leds1[i] = CRGB(46, 51, 36);
}
FastLED.show(); // a mettre dans la dernière boucle for
delay(1); // a mettre dans la dernière boucle for
}
while (true) {
}
}
void chenillard(CRGB leds1[], int numLEDs1, CRGB leds2[], int numLEDs2) {
for (int i=0; i<=29; i++){
leds2[i] = CRGB(0, 51, 36);
FastLED.show();
delay(15);
} }
} }
8 replies