Compare commits

...

1 Commits

Author SHA1 Message Date
Patrizio Trinchini cd9c35505f Added color wipe effect 2 years ago
  1. 2
      include/header.h
  2. 19
      src/main.cpp

2
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 SnowSparkle(byte red, byte green, byte blue, int SparkleDelay, int SpeedDelay);
void RunningLights(byte red, byte green, byte blue, int WaveDelay); void RunningLights(byte red, byte green, byte blue, int WaveDelay);
void colorWipe(byte red, byte green, byte blue, int SpeedDelay); void colorWipe(byte red, byte green, byte blue, int SpeedDelay);
void colorWipe2(uint32_t color, int wait);
byte * Wheel(byte WheelPos); byte * Wheel(byte WheelPos);
void rainbowCycle(int SpeedDelay); void rainbowCycle(int SpeedDelay);

19
src/main.cpp

@ -14,6 +14,7 @@ void setup()
{ {
strip.begin(); strip.begin();
strip.show(); // Initialize all pixels to 'off' strip.show(); // Initialize all pixels to 'off'
strip.setBrightness(50);
pinMode(2,INPUT_PULLUP); // internal pull-up resistor pinMode(2,INPUT_PULLUP); // internal pull-up resistor
attachInterrupt (digitalPinToInterrupt (BUTTON), changeEffect, CHANGE); // pressed attachInterrupt (digitalPinToInterrupt (BUTTON), changeEffect, CHANGE); // pressed
} }
@ -22,7 +23,7 @@ void setup()
void loop() { void loop() {
EEPROM.get(0,selectedEffect); EEPROM.get(0,selectedEffect);
if(selectedEffect>18) { if(selectedEffect>19) {
selectedEffect=0; selectedEffect=0;
EEPROM.put(0,0); EEPROM.put(0,0);
} }
@ -163,6 +164,14 @@ void loop() {
meteorRain(0xff,0xff,0xff,10, 64, true, 30); meteorRain(0xff,0xff,0xff,10, 64, true, 30);
break; 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 <NUM_LEDS; i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}
void rainbowCycle(int SpeedDelay) { void rainbowCycle(int SpeedDelay) {
byte *c; byte *c;
uint16_t i, j; uint16_t i, j;

Loading…
Cancel
Save