Subversion Repositories Projects

Rev

Go to most recent revision | Details | 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 out
8
----------------------------------------------
9
 
10
Command / Befehl:
11
----------------------------------------------
12
fadeout(r, g, b, dly, ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8)
13
----------------------------------------------
14
 
15
 
16
Code:
17
----------------------------------------------
18
void fadeout(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 = 10; j < 127; j++){
23
  uint8_t rh = r-(j*r/127);
24
   if((r || 0) && rh < r) r2 = rh;
25
   if(r == 0) r2 = 0;
26
  uint8_t gh = g-(j*g/127);
27
   if((g || 0) && gh < g) g2 = gh;
28
   if(g == 0) g2 = 0;
29
  uint8_t bh = b-(j*b/127);
30
   if((b || 0) && bh < b) b2 = bh;
31
   if(b == 0) b2 = 0;
32
for(int i=0; i<riggerSize; i++) {
33
 strip.setPixelColor(i, r2, g2, b2,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8);
34
 }
35
  strip.show();
36
  delay(wait);
37
 }
38
for(int i=0; i<riggerSize; i++) {
39
 strip.setPixelColor(i, 0,ri1, ri2, ri3, ri4, ri5, ri6, ri7, ri8);
40
 }
41
}
42
----------------------------------------------