NEXT - Effekt

This commit is contained in:
starcalc 2019-07-02 18:34:45 +02:00
parent 429e90290e
commit 265ae2f0ac
1 changed files with 56 additions and 0 deletions

View File

@ -34,6 +34,7 @@ int x = matrix.width();
int pass = 0;
bool stopAfterCompletion;
int effect = 0;
void StripComplete() {
if (stopAfterCompletion)
@ -251,6 +252,59 @@ void loopHandler() {
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() {
Serial.begin(115200);
@ -264,6 +318,7 @@ void setup() {
homieNode.advertise("clear").settable(onSetClear);
homieNode.advertise("length").settable(onSetLength);
homieNode.advertise("icon").settable(onSetIcon);
homieNode.advertise("next").settable(onSetNext);
homieNode.advertiseRange("pixels", 0, (NUMPIXELS - 1) * 7).settable(onSetPixels);
@ -275,6 +330,7 @@ void setup() {
strip.show();
stopAfterCompletion = false; // Default
strip.Plasma(); // Default effect
effect = 0;
Homie.setup();