I'm sure this has to be possible ... just not for me, tho.
This is my latest version of my script:
#include <Adafruit_NeoPixel.h>
#define PIN 5 // output pin Neopixel is attached to
#define NUMPIXELS 19 // number of neopixels in "strip"
#define delayval 20 // timing delay in milliseconds
#define ranMin 100 //minimum time for random intervall
#define ranMax 150 //maximum time for random intervall
#define anipause 100 //time between animation steps
#define anistep 6 //animation stepsize
#define ranTwinkleMin 1000 //minimum time for random intervall
#define ranTwinleMax 2500 //maximum time for random intervall
#define twinkleTime 20 //length of twinkle
#define colorStep 10 //change color this much each step
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int LEDColor[7][4]={{127,127,0,0},{127,127,0,0},{127,127,0,0},{127,127,0,0},{127,127,0,0},{127,127,0,0},{127,127,0,0}}; //LED block see above
int LED8Color[]={127,127,0,0}; //LED 2
int LED9Color[]={127,127,0,0}; //LED 4
int LED10Color[]={127,127,0,0}; //LED 6
int LED11Color[]={127,127,0,0}; //LED 8
int LED12Color[]={127,127,0,0}; //LED 10
int LED13Color[]={127,127,0,0}; //LED 12
unsigned long nextMillis[]={0,0,0,0,0,0,0};
int ranpau[7]={0,0,0,0,0,0,0};
int animation=0; // for breath animation, value in degrees for cos function
unsigned long nextAni=millis()+anipause;;
unsigned long nextTwinkle=millis()+random(ranTwinkleMin, ranTwinleMax);
bool twinkleStep=false;
int twinkleLED; // defines which LED should twinkle
void setup() {
// Initialize the NeoPixel library.
pixels.begin();
for (int i=0; i <= 7 ; i++) // set random intervalls for all in LED block
{
ranpau[i]=random(ranMin, ranMax);
}
}
void loop() {
for (int i=0; i < 7 ; i++) // loop through LED block and see if one is to be updated
{
if (millis()>=nextMillis[i]){ //has LED i an event upcomming?
nextMillis[i]=millis()+ranpau[i]; //update time for next change ?? maybe put this at end?
switch (i) {
case 0: // first set of LEDs
pixels.setPixelColor(0, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(12, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 1: // second set of LEDs ... you get the gist
pixels.setPixelColor(2, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(13, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 2:
pixels.setPixelColor(4, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(14, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 3:
pixels.setPixelColor(6, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(15, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 4:
pixels.setPixelColor(8, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(16, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 5:
pixels.setPixelColor(10, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
pixels.setPixelColor(17, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
case 6:
pixels.setPixelColor(18, pixels.Color(breath(LEDColor[i][0]),breath(LEDColor[i][1]),breath(LEDColor[i][2])));
break;
default: // nothing here! go home, could use this to catch error.
break;
}
colorRotation(i,LEDColor[i][0],LEDColor[i][1],LEDColor[i][2],LEDColor[i][3]); // update to next color in animation for next call
pixels.show(); //fun part
}
}
if (millis()>=nextAni){ // update breath animation
animation=animation+anistep;
nextAni=millis()+anipause;
}
if (millis()>=nextTwinkle){
if (!twinkleStep){
twinkleStep = true ;
nextTwinkle=millis()+twinkleTime;
twinkle();
} else {
nextTwinkle=millis()+random(ranTwinkleMin, ranTwinleMax);
twinkleStep=false;
switch (twinkleLED){
case 0:
case 12:
pixels.setPixelColor(0, pixels.Color(breath(LEDColor[0][0]),breath(LEDColor[0][1]),breath(LEDColor[0][2])));
pixels.setPixelColor(12, pixels.Color(breath(LEDColor[0][0]),breath(LEDColor[0][1]),breath(LEDColor[0][2])));
break;
case 2:
case 13:
pixels.setPixelColor(2, pixels.Color(breath(LEDColor[1][0]),breath(LEDColor[1][1]),breath(LEDColor[1][2])));
pixels.setPixelColor(13, pixels.Color(breath(LEDColor[1][0]),breath(LEDColor[1][1]),breath(LEDColor[1][2])));
break;
case 4:
case 14:
pixels.setPixelColor(4, pixels.Color(breath(LEDColor[2][0]),breath(LEDColor[2][1]),breath(LEDColor[2][2])));
pixels.setPixelColor(14, pixels.Color(breath(LEDColor[2][0]),breath(LEDColor[2][1]),breath(LEDColor[2][2])));
break;
case 6:
case 15:
pixels.setPixelColor(6, pixels.Color(breath(LEDColor[3][0]),breath(LEDColor[3][1]),breath(LEDColor[3][2])));
pixels.setPixelColor(15, pixels.Color(breath(LEDColor[3][0]),breath(LEDColor[3][1]),breath(LEDColor[3][2])));
break;
case 8:
case 16:
pixels.setPixelColor(8, pixels.Color(breath(LEDColor[4][0]),breath(LEDColor[4][1]),breath(LEDColor[4][2])));
pixels.setPixelColor(16, pixels.Color(breath(LEDColor[4][0]),breath(LEDColor[4][1]),breath(LEDColor[4][2])));
break;
case 10:
case 17:
pixels.setPixelColor(10, pixels.Color(breath(LEDColor[5][0]),breath(LEDColor[5][1]),breath(LEDColor[5][2])));
pixels.setPixelColor(17, pixels.Color(breath(LEDColor[5][0]),breath(LEDColor[5][1]),breath(LEDColor[5][2])));
break;
case 18:
pixels.setPixelColor(18, pixels.Color(breath(LEDColor[6][0]),breath(LEDColor[6][1]),breath(LEDColor[6][2])));
break;
}
pixels.show();
}
}
}
int breath(int colorin){ // changes brighness depending on animation step
int colorout= colorin * ((cos(((animation%360)/180*M_PI))+1.5)/2.5);
return colorout;
}
void twinkle(){
twinkleLED = random(0,NUMPIXELS); // get a random pixel
pixels.setPixelColor(twinkleLED, pixels.Color(255,255,0)); // make it bright yellow
pixels.show(); // show it
}
void colorRotation(int LED,int RredColor,int RgreenColor,int RblueColor,int circ){ // cycles through all vcolors
switch (circ) { // circ defines at which point the color cycle is.
case 0: //green
if (RgreenColor <= 254) {
RredColor=RredColor-colorStep;
RgreenColor=RgreenColor+colorStep;
if (RredColor<0) {RredColor=0;}
if (RgreenColor>255) {RgreenColor=255;}
}
else {
circ++;
}
break;
case 1: //blue
if (RblueColor <= 254) {
RgreenColor=RgreenColor-colorStep;
RblueColor=RblueColor+colorStep;
if (RgreenColor<0) {RgreenColor=0;}
if (RblueColor>255) {RblueColor=255;}
}
else {
circ++;
}
break;
case 2: //red
if (RredColor <= 254) {
RblueColor=RblueColor-colorStep;
RredColor=RredColor+colorStep;
if (RblueColor<0) {RblueColor=0;}
if (RredColor>255) {RredColor=255;}
}
else {
circ=0;
}
break;
default:
circ=0;
break;
}
// update colors:
LEDColor[LED][0]= RredColor;
LEDColor[LED][1]= RgreenColor;
LEDColor[LED][2]= RblueColor;
LEDColor[LED][3]= circ;
}
Problem: Sketch uses 6662 bytes (110%) of program storage space. Maximum is 6012 bytes.