Subversion Repositories Projects

Rev

Rev 1755 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1755 - 1
Light Sequence Template:
2
 
3
Created by / Erstellt von:  "Magomora"
4
 
5
Explanation / Erklärung:
6
----------------------------------------------
7
Fade in LED color in
8
----------------------------------------------
9
 
10
Command / Befehl:
11
----------------------------------------------
1757 - 12
fadein(r, g, b, dly, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8);
1755 - 13
----------------------------------------------
14
 
15
 
16
Code:
17
----------------------------------------------
18
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) {
19
 
20
 uint8_t r2, g2, b2;
21
 
22
for (uint8_t j = 127; j > 10; j--){
23
  uint8_t rh = r-(j*r/127);
24
   if((r || rh) && rh <= r) r2 = rh;
25
   if(rh > r) r2 = r;
26
   if(r == 0) r2 = 0;
27
  uint8_t gh = g-(j*g/127);
28
   if((g || gh) && gh <= g) g2 = gh;
29
   if(gh > g) g2 = g;
30
   if(g == 0) g2 = 0;
31
  uint8_t bh = b-(j*b/127);
32
   if((b || bh) && bh <= b) b2 = bh;
33
   if(bh > b) b2 = b;
34
   if(b == 0) b2 = 0;
35
 for(uint8_t i=0; i<riggerSize; i++) {
36
 strip.setPixelColor(i, r2, g2, b2, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8);
37
 }
38
  strip.show();
39
  delay(wait);
40
 }
41
}
42
----------------------------------------------