You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
- lambda: |
|
name: RGB Breathing |
|
update_interval: 16s #Finetune to your liking with the transition lenght below |
|
lambda: |- |
|
#define Color1 1.0, 0.0, 0.0 //These are the colors defined, feel free to change or extend the list |
|
#define Color2 1.0, 0.5, 0.0 //if you extend the list, dont forget to add them in the switch loop below |
|
#define Color3 1.0, 1.0, 0.0 //and remember to adjust the reset counter at the bottom |
|
#define Color4 0.5, 1.0, 0.0 |
|
#define Color5 0.0, 1.0, 0.0 |
|
#define Color6 0.0, 1.0, 0.5 |
|
#define Color7 0.0, 1.0, 1.0 |
|
#define Color8 0.0, 0.5, 1.0 |
|
#define Color9 0.0, 0.0, 1.0 |
|
#define Color10 0.5, 0.0, 1.0 |
|
#define Color11 0.5, 0.0, 1.0 |
|
#define Color12 1.0, 0.0, 0.5 |
|
static int state = 0; |
|
static int color = 1; |
|
auto call = id(light1).turn_on(); |
|
call.set_transition_length(15000); |
|
if (state == 0) |
|
{ |
|
call.set_brightness(0.01); |
|
|
|
} |
|
else if (state == 1) |
|
{ |
|
switch(color) |
|
{ |
|
case 1: call.set_rgb(Color1); |
|
break; |
|
case 2: call.set_rgb(Color2); |
|
break; |
|
case 3: call.set_rgb(Color3); |
|
break; |
|
case 4: call.set_rgb(Color4); |
|
break; |
|
case 5: call.set_rgb(Color5); |
|
break; |
|
case 6: call.set_rgb(Color6); |
|
break; |
|
case 7: call.set_rgb(Color7); |
|
break; |
|
case 8: call.set_rgb(Color8); |
|
break; |
|
case 9: call.set_rgb(Color9); |
|
break; |
|
case 10: call.set_rgb(Color10); |
|
break; |
|
case 11: call.set_rgb(Color11); |
|
break; |
|
case 12: call.set_rgb(Color12); |
|
break; |
|
} |
|
call.set_brightness(1.0); |
|
} |
|
|
|
state ++; |
|
if (state == 2){ |
|
state = 0; |
|
} |
|
color++; |
|
if(color == 7) |
|
{ |
|
color = 1; |
|
} |
|
call.perform();
|
|
|