testbericht zum WS2812

Hy, ich schau mir das mal an und Probier nen bissel aus.
Ich füge mal meinen Aktuellen Code der Treppenbeleuchtung .

#include "FastLED.h"
#define NUM_LEDS 80
// Data pin
#define DATA_PIN 13

CRGB leds[NUM_LEDS];

int pirPin1 = 7;     //the digital pin Taster Unten
int pirPin2 = 8;     //the digital pin Taster Oben

int globaldelay = 5;
        
int mode;
int treppe = 70;      
int ledsstufe = 5;   // Anzahl der LED´s Pro Stufe
int laufzeit= 15000; // Maximal laufzeit
int helli = 200;     // hier die max helligkeit vorgeben
int fadezeit =5;     // Zeit zum hochlauf/ablauf der Helligkeit
int fadestufen = 10;
int an = false;       
int oben = false;
int unten = false;
int fa1 =0;

////////////////



void setup()
{
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  
  Serial.begin(9600); // connect to the serial port
 
 }


////////////////
// ausschalten aller Stufen von unten nach oben

void untenAN (){

 
 
  for (int stufe=0; stufe<=treppe ; stufe+=ledsstufe){
      if (fa1 == 0){
            for (int i=0; i<=helli; i+=fadestufen){
              
               leds [stufe] =CRGB(0,i,0);        //
               leds [stufe+1] =CRGB(0,i,0);      //
               leds [stufe+2] =CRGB(0,i,0);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,i,0);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,i,0);      //  
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
                 FastLED.show();
             delay(fadezeit);
           
            }
      }
      
      if (fa1 ==1){
           for (int i=0; i<=helli; i+=fadestufen){
              
               leds [stufe] =CRGB(0,0,i);        //
               leds [stufe+1] =CRGB(0,0,i);      //
               leds [stufe+2] =CRGB(0,0,i);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,0,i);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,0,i);      //  
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
                 FastLED.show();
             delay(fadezeit);
           
            }       
      }
}

}


/////////////////
// anschalten aller Stufen von oben nach unten

void obenAN (){


  for (int stufe=treppe; stufe>=0 ; stufe-=ledsstufe){
    if (fa1 ==0){
    
            
            for (int i=0; i<=helli; i+=fadestufen){
               leds [stufe] =CRGB(0,i,0);        //
               leds [stufe+1] =CRGB(0,i,0);      //
               leds [stufe+2] =CRGB(0,i,0);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,i,0);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,i,0);      //  im Moment 1 LED´s pro Stufe
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
            FastLED.show();
         delay(fadezeit);
   }
    }
  if (fa1==1){
     for (int i=0; i<=helli; i+=fadestufen){
              
               leds [stufe] =CRGB(0,0,i);        //
               leds [stufe+1] =CRGB(0,0,i);      //
               leds [stufe+2] =CRGB(0,0,i);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,0,i);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,0,i);      //  
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
                 FastLED.show();
             delay(fadezeit);
}
}

  }
}
///////////////
// ausschalten aller Stufen von unten nach oben

void untenAUS (){

 
  for (int stufe=0; stufe<=treppe ; stufe+=ledsstufe){
        if (fa1 ==0){
            for (int i=helli; i>=0; i-=fadestufen){
               leds [stufe] =CRGB(0,i,0);        //
               leds [stufe+1] =CRGB(0,i,0);      //
               leds [stufe+2] =CRGB(0,i,0);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,i,0);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,i,0);      //  im Moment 1 LED´s pro Stufe
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
           FastLED.show();
         delay(fadezeit);
            }
 }
       if (fa1 ==1){
         for (int i=helli; i>=0; i-=fadestufen){
              
               leds [stufe] =CRGB(0,0,i);        //
               leds [stufe+1] =CRGB(0,0,i);      //
               leds [stufe+2] =CRGB(0,0,i);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,0,i);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,0,i);      //  
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
                 FastLED.show();
             delay(fadezeit);
           
            }
       }
}

}



////////////////
// ausschalten aller Stufen von oben nach unten 

void obenAUS (){


  for (int stufe=treppe; stufe>=0 ; stufe-=ledsstufe){
   if (fa1 ==0){
            for (int i=helli; i>=0; i-=fadestufen){
               leds [stufe] =CRGB(0,i,0);        //
               leds [stufe+1] =CRGB(0,i,0);      //
               leds [stufe+2] =CRGB(0,i,0);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,i,0);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,i,0);      //  im Moment 1 LED´s pro Stufe
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
            FastLED.show();
         delay(fadezeit);
   }
  }
 
  if (fa1 ==1){
         
            for (int i=helli; i>=0; i-=fadestufen){
               leds [stufe] =CRGB(0,i,0);        //
               leds [stufe+1] =CRGB(0,i,0);      //
               leds [stufe+2] =CRGB(0,i,0);      //  Hier müssen manuell die Leds 
               leds [stufe+3] =CRGB(0,i,0);      //  pro Stufe geschaltet werden
               leds [stufe+4] =CRGB(0,i,0);      //  im Moment 1 LED´s pro Stufe
               //leds [stufe+5] =CRGB(i,0,0);      //  
               //leds [stufe+6] =CRGB(i,0,0);      //
            FastLED.show();
         delay(fadezeit);
           
            }   
     
}
}

}

void rainbow2(int mode){
 
  //for (int t = 0; t<=200;){
    for(int i = 255; i >= 0; i--)
    {
      for (int col = 0; col < 14; col++) {
        for(int row = 0; row < 5; row++) {
          int v = ((10*row) + i) % 255;
          setHue2(v,(5*col + row));        
        } 
      }
      //t +=1;
      Serial.print("  ");
      Serial.print(i);
      Serial.print("  ");
      FastLED.show();
      delay(100);
      
    }

    
  //}delay(100);

}




/**
 * function to set a specific LED in the chain to a given value of the HVS color-circle
 *
 * this is simplified version of HVS to RGB comversion
 * see: http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
 *
 * in all cases saturation and value are "1" so we do not have to calculate all parts
 *
 * we also use a range of 0 to 255 instead of 0 to 360 for HUE
 **/
void setHue2(int h, int pin) {
  //this is the algorithm to convert from RGB to HSV
  double r=0; 
  double g=0; 
  double b=0;

  double hf=h/42.5;

  //calculate with 255 instead of 360° for the whole color-circle so we have to divide by 42.5 instead of 60°
  int i=(int)floor(h/42.5);
  double f = h/42.5 - i;
  double qv = 1 - f;
  double tv = f;

  switch (i)
  {
  case 0: 
    r = 1;
    g = tv;
    break;
  case 1: 
    r = qv;
    g = 1;
    break;
  case 2: 
    g = 1;
    b = tv;
    break;
  case 3: 
    g = qv;
    b = 1;
    break;
  case 4:
    r = tv;
    b = 1;
    break;
  case 5: 
    r = 1;
    b = qv;
    break;
  }

  //set each component to a integer value between 0 and 255
  leds[pin].r = constrain((int)255*r,0,255);
  leds[pin].g = constrain((int)255*g,0,255);
  leds[pin].b = constrain((int)255*b,0,255);

}

/**
 * function to set a specific LED in the chain to concrete R, G and B values
 *
 **/
void setRGB(int r, int g, int b, int pin) {
  //set each component to a integer value between 0 and 255
  leds[pin].r = r;
  leds[pin].g = g;
  leds[pin].b = b;

}