NEXT - Effekt
This commit is contained in:
parent
429e90290e
commit
265ae2f0ac
|
@ -34,6 +34,7 @@ int x = matrix.width();
|
||||||
int pass = 0;
|
int pass = 0;
|
||||||
|
|
||||||
bool stopAfterCompletion;
|
bool stopAfterCompletion;
|
||||||
|
int effect = 0;
|
||||||
|
|
||||||
void StripComplete() {
|
void StripComplete() {
|
||||||
if (stopAfterCompletion)
|
if (stopAfterCompletion)
|
||||||
|
@ -251,6 +252,59 @@ void loopHandler() {
|
||||||
matrix.Update();
|
matrix.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool onSetNext(const HomieRange& range, const String& value) {
|
||||||
|
switch (effect)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
matrix.None();
|
||||||
|
strip.Scanner(strip.Color(255, 0, 0), 40, true, true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
matrix.None();
|
||||||
|
strip.Scanner(strip.Color(255, 0, 0));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
matrix.None();
|
||||||
|
strip.Scanner(strip.Color(255, 0, 0), 40, true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
matrix.None();
|
||||||
|
strip.Scanner(strip.Color(255, 0, 0), 40, true, true);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
matrix.None();
|
||||||
|
strip.RainbowCycle(50);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
matrix.None();
|
||||||
|
strip.TheaterChase(strip.Color(255, 0, 0), strip.Color(0, 0, 255), 100);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
matrix.None();
|
||||||
|
strip.Fade(strip.Color(255, 0, 0), strip.Color(0, 0, 255), 200, 100);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
matrix.None();
|
||||||
|
strip.RandomFade();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
matrix.None();
|
||||||
|
strip.Smooth(16, 80, 50, 40);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
matrix.None();
|
||||||
|
strip.Plasma();
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
strip.None();
|
||||||
|
matrix.ScrollText("CTDO");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
effect++;
|
||||||
|
if (effect>10) { effect=0; }
|
||||||
|
homieNode.setProperty("next").send(value);
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
@ -264,6 +318,7 @@ void setup() {
|
||||||
homieNode.advertise("clear").settable(onSetClear);
|
homieNode.advertise("clear").settable(onSetClear);
|
||||||
homieNode.advertise("length").settable(onSetLength);
|
homieNode.advertise("length").settable(onSetLength);
|
||||||
homieNode.advertise("icon").settable(onSetIcon);
|
homieNode.advertise("icon").settable(onSetIcon);
|
||||||
|
homieNode.advertise("next").settable(onSetNext);
|
||||||
homieNode.advertiseRange("pixels", 0, (NUMPIXELS - 1) * 7).settable(onSetPixels);
|
homieNode.advertiseRange("pixels", 0, (NUMPIXELS - 1) * 7).settable(onSetPixels);
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,6 +330,7 @@ void setup() {
|
||||||
strip.show();
|
strip.show();
|
||||||
stopAfterCompletion = false; // Default
|
stopAfterCompletion = false; // Default
|
||||||
strip.Plasma(); // Default effect
|
strip.Plasma(); // Default effect
|
||||||
|
effect = 0;
|
||||||
|
|
||||||
Homie.setup();
|
Homie.setup();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue