I am running Ala-sequence BUBBLES code and I have modified the colours and it works fine, but now I added a PIR sensor (HC-SR501) .
The 60 led WS2812 strip and Arduino Uno run on 5V 4A, this I also use to power the sensor.
When the timer of the sensor goes low, the animation stops abrupt. And sometimes to leave a few LED's on. I use the animation to simulate rain... (set up without PIR, so constant rain on Relign Paneel Herfst 1 on Vimeo)
I would like the animation to run till the end and then stop when the PIR goes LOW. This is my -cut&pasted- code
#include <AlaLedRgb.h>
#define NUM_LEDS 60
#define PIN 6
#define COLOR R,G,B,
const byte pirPin = 3;
AlaLedRgb rgbStrip;
// custom palette : black white black red green blue
AlaColor mycolors_[6] = { 0x000000, 0xFFFFFF, 0x000000, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF };
AlaPalette mycolors = { 6, mycolors_ };
AlaSeq seq[] = {
{ ALA_OFF, 1000, 1, alaPalNull },
{ ALA_BUBBLES, 100, 1800, mycolors },
{ ALA_OFF, 1000, 1, alaPalNull },
{ ALA_BUBBLES, 100, 2000, mycolors },
{ ALA_ENDSEQ }
};
void setup() {
pinMode(6, OUTPUT);
(60);
delay(50);
rgbStrip. initWS2812 (60, 6);
rgbStrip. setBrightness (0x332244);
rgbStrip. setAnimation(seq);
}
void loop()
{
if(digitalRead(pirPin) == HIGH) // if there is motion
{
rgbStrip. runAnimation();
int (num1);
int animation;
int currAnim;
}
}