Subversion Repositories Projects

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

Light Sequence Template:

Created by / Erstellt von:  "Magomora"

Explanation / Erklärung:
----------------------------------------------
Fade in LED color in
----------------------------------------------

Command / Befehl:
----------------------------------------------
fadein(r, g, b, dly, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8)
----------------------------------------------


Code:
----------------------------------------------
void fadein( uint8_t r, uint8_t g, uint8_t b, uint8_t wait, uint8_t ri1, uint8_t ri2, uint8_t ri3, uint8_t ri4, uint8_t ri5, uint8_t ri6, uint8_t ri7, uint8_t ri8) { 

 uint8_t r2, g2, b2;

for (uint8_t j = 127; j > 10; j--){
  uint8_t rh = r-(j*r/127);
   if((r || rh) && rh <= r) r2 = rh;
   if(rh > r) r2 = r;
   if(r == 0) r2 = 0;
  uint8_t gh = g-(j*g/127);
   if((g || gh) && gh <= g) g2 = gh;
   if(gh > g) g2 = g;
   if(g == 0) g2 = 0;
  uint8_t bh = b-(j*b/127);
   if((b || bh) && bh <= b) b2 = bh;
   if(bh > b) b2 = b;
   if(b == 0) b2 = 0;
 for(uint8_t i=0; i<riggerSize; i++) {
 strip.setPixelColor(i, r2, g2, b2, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8);
 }  
  strip.show();
  delay(wait);
 }
}
----------------------------------------------