Hello guys I'm new here, I have been working on cylon effect under fastLED example and I have decided to split the effect in the middle but when I run the code it doesn't work as intended. One side works fine and the other is very slow. is there wrong with the code?
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t hue = 0;
for(int a = 9; a >= 0; a--) {
for(int x = 11; x < NUM_LEDS; x++) {
leds[a] = CHSV(hue++, 255, 255);
leds[x] = CHSV(hue++, 255, 255);
FastLED.show();
fadeall();
delay(30);
}
}
}
I'm sorry I'm not quite good at for loops I thought that loop A is for assigning leds 1 to 9 and loop X is for the rest... Do you have an idea how how to put these ranges in one for loop?
Just 21 leds
The light runs like this
<<<<<<11th>>>>>
|1-10| |12-21|
the 11th is just black, the color is just the same as the previous code. Changing color as its runs and it fade a little before the next wave of color.
Let's get them in the right order before adding other effects
I am presuming that the LEDs come on in pairs like this
10 and 12
9 and 13
8 and 14
and so on
Start by trying this
void setup()
{
Serial.begin(115200);
while (!Serial);
}
void loop()
{
byte offset = 2;
for (int x = 10; x >= 0; x--)
{
Serial.print(x);
Serial.print("\t"); //tab
Serial.println(x + offset);
delay(1000);
offset = offset + 2;
}
Serial.println();
}
If the LED numbers are correct when viewed in the Serial monitor then apply the principle to your code to turn on the pairs of LEDs. When should the LEDs be turned off ?
I just just changed the offset to 1 although it doesn't have a gap in the middle but its good enough for me.. thank you for the help it saved me hours of frustrations . I really appreciate it.