-1

Uploading this to my Nano connected to a WS2812 led strip just freezes the current display and does not start the sequence. I can upload other Examples to the circuit and they work fine. Still new to FastLED and Arduino. The problem appeared when I added the for loop.

int breath;
void loop() { 
  // Fade in, Green, ~ 4 seconds
  leds[0] = CRGB::Green;
  for (int breath = 0; breath >= 255; breath++ ) {
    FastLED.setBrightness(breath);
    FastLED.show();
    delay(15);
    
  }
// Fade out, Aqua, ~8 seconds
  leds[0] = CRGB::Aqua;
  for (int breath = 255;breath <= 0; breath = breath-1 ) {
    FastLED.setBrightness(breath);
    FastLED.show();
   delay(31);
    
  }
}

1 Answers1

0

Problem could be related to this line

for (int breath = 255;breath <= 0; breath = breath-1 ) {

You're starting at 255, your test breath<=0 will never be true so the for loop immediately kicks out. Switch from < to > and this might do what you want.

Adam
  • 44
  • 8