Fastled Library Goes slow

I develope a signal for certain ambiental values and will use WS2812B strip leds around a tube for 360 visualization.
I use 600 Leds (2 Strips), the first X leds is all green, next group yellow., orange,…violet.
The principal problem is the leds goes up one by one but slow (compared with some videos in Internet)…and hang-up the Photon…
The second problem is the color…I put Green but the leds go Red, I solved this last issue whit NEOPIXEL.
Any help willbe very appreciated.
Thanks in advance

#include <FastLED.h>

//#define FASTLED_ALLOW_INTERRUPTS 1

//#include <FastLED.h>


FASTLED_USING_NAMESPACE;

#define LED_PIN     D6
#define CHIPSET     WS2812B
#define NUMPIXELS 600

CRGB    leds[NUMPIXELS];
void apaga_leds();
void led_verde();
void led_amarillo();
void led_naranja();
void led_rojo();
void led_violeta();
int i;

//	CRGB leds[NUM_LEDS];
void setup() { FastLED.addLeds<CHIPSET,LED_PIN>(leds, NUMPIXELS); 
                }
void loop() {
    
	    for(i=0;i < 600;i++)
	    {
		leds[i] = CRGB::Blue; FastLED.show(); 
		//delay(3000); 
		//leds[0] = CRGB::Blue; FastLED.show(); delay(3000);
	    }
	    delay(3000);
	    for(i=0;i < 600;i++)
	    {
		leds[i] = CRGB::Black; FastLED.show(); 
		//delay(3000); 
		//leds[0] = CRGB::Blue; FastLED.show(); delay(3000);
	    }
	    
	    for(i=0;i < 12;i++)
	    {
	        semaforo(i);
	        delay(2000);
	        
	    }
	  
	   
	}
	
void apaga_leds(){
    for(int i=0;i<NUMPIXELS;i++){
   	leds[i] = CRGB::Black; FastLED.show();
	
     //delay(0); // Delay for a period of time (in milliseconds)
    }
    
    }
void apaga_leds_violeta(){
  for(int i=(NUMPIXELS-120);i<NUMPIXELS;i++){
  

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    leds[i] = CRGB::Black; FastLED.show();
  
    }
}
void apaga_leds_rojo(){
 for(int i=(NUMPIXELS-240);i<(NUMPIXELS-121);i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
   leds[i] = CRGB::Black; FastLED.show();
   
    }
}
void apaga_leds_naranja(){
for(int i=(NUMPIXELS-360);i<(NUMPIXELS-241);i++){
    
    leds[i] = CRGB::Black; FastLED.show();
    }
}
void apaga_leds_amarillo(){
for(int i=(NUMPIXELS-480);i<(NUMPIXELS-361);i++){
    leds[i] = CRGB::Black; FastLED.show();
    }
}
void apaga_leds_verde(){
for(int i=0;i<(NUMPIXELS-481);i++){
    leds[i] = CRGB::Black; FastLED.show();
    }
}
void led_violeta(){
 // apaga_leds();
for(int i=(NUMPIXELS-120);i<NUMPIXELS;i++){
    
leds[i] = CRGB::Violet; FastLED.show();
    
    }
   
}
void led_rojo(){
//  apaga_leds();
for(int i=(NUMPIXELS-240);i<(NUMPIXELS-121);i++){
   leds[i] = CRGB::Red; FastLED.show();
}
}
void led_naranja(){
  //apaga_leds();
for(int i=(NUMPIXELS-360);i<(NUMPIXELS-241);i++){

leds[i] = CRGB::Orange; FastLED.show();

  }
}
void led_amarillo(){
  //apaga_leds();

for(int i=(NUMPIXELS-480);i<(NUMPIXELS-361);i++){
leds[i] = CRGB::Yellow; FastLED.show();
  }
}
void led_verde(){
  //apaga_leds();
 
for(int i=0;i<(NUMPIXELS-481);i++){
    
    leds[i] = CRGB::Green; FastLED.show();

}
}
void solmaforo(int raw_control){

switch(raw_control){
  case 0:
     apaga_leds();
     
  case 1:
     apaga_leds();
     led_verde();
     break;
  case 2:
     apaga_leds();
     led_verde();
     break;
     case 3:
     apaga_leds_violeta();
     apaga_leds_rojo();
     apaga_leds_naranja();
     led_verde();
     led_amarillo();
     break;
    case 4:
    apaga_leds_violeta();
     apaga_leds_rojo();
     apaga_leds_naranja();
     led_verde();
     led_amarillo();
     break;
     case 5:
     apaga_leds_violeta();
     apaga_leds_rojo();
     apaga_leds_naranja();
     led_verde();
     led_amarillo();
     break;
     case 6:
     apaga_leds_violeta();
     apaga_leds_rojo();
     led_verde();
     led_amarillo();
     led_naranja();
     break;
     case 7:
     apaga_leds_violeta();
     apaga_leds_rojo();
     led_verde();
     led_amarillo();
     led_naranja();
     break;
case 8:
     apaga_leds_violeta();
     led_verde();
     led_amarillo();
     led_naranja();
     led_rojo();
     break;
     case 9:
     apaga_leds_violeta();
     led_verde();
     led_amarillo();
     led_naranja();
     led_rojo();
case 10:
     led_verde();
     led_amarillo();
     led_naranja();
     led_rojo();
     led_violeta();
case 11:
     led_verde();
     led_amarillo();
     led_naranja();
     led_rojo();
     led_violeta();
     break;
  }
raw_control=0;
}

There are different types of NeoPixels some use RGB others BGR or even more combinations (e.g. with a dedicated W LED).

Thay may be due to calling FastLED.show() after updating each individual pixel.
You'd normally first update all pixels and then call FastLED.show() once when done.
This will cause the update to become 600 times faster :wink:

1 Like

Solved, yes it is I put the FastLEd.Show outside the loop and the things go Fast!!!
Thanks a lot!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.