From cd9c35505f818d97472f899f8b221d5e7ccfceea Mon Sep 17 00:00:00 2001 From: Patrizio Trinchini Date: Fri, 29 Dec 2023 17:07:11 +0100 Subject: [PATCH] Added color wipe effect --- include/header.h | 2 +- src/main.cpp | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/header.h b/include/header.h index d87d8b4..f81560c 100644 --- a/include/header.h +++ b/include/header.h @@ -28,7 +28,7 @@ void Sparkle(byte red, byte green, byte blue, int SpeedDelay); void SnowSparkle(byte red, byte green, byte blue, int SparkleDelay, int SpeedDelay); void RunningLights(byte red, byte green, byte blue, int WaveDelay); void colorWipe(byte red, byte green, byte blue, int SpeedDelay); - +void colorWipe2(uint32_t color, int wait); byte * Wheel(byte WheelPos); void rainbowCycle(int SpeedDelay); diff --git a/src/main.cpp b/src/main.cpp index f79a2ae..189bb05 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,7 @@ void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' + strip.setBrightness(50); pinMode(2,INPUT_PULLUP); // internal pull-up resistor attachInterrupt (digitalPinToInterrupt (BUTTON), changeEffect, CHANGE); // pressed } @@ -22,7 +23,7 @@ void setup() void loop() { EEPROM.get(0,selectedEffect); - if(selectedEffect>18) { + if(selectedEffect>19) { selectedEffect=0; EEPROM.put(0,0); } @@ -163,6 +164,14 @@ void loop() { meteorRain(0xff,0xff,0xff,10, 64, true, 30); break; } + + case 19: { + colorWipe2(strip.Color( 255, 255, 255), 10); // White + colorWipe2(strip.Color( 0, 0, 255), 10); // Blue + colorWipe2(strip.Color( 255, 169, 87), 10); // 2700k + colorWipe2(strip.Color( 0, 0, 255), 10); // Blue + break; + } } } @@ -472,6 +481,14 @@ void colorWipe(byte red, byte green, byte blue, int SpeedDelay) { } } +void colorWipe2(uint32_t color, int wait) { + for(int i=0; i