ok ein paar teile kann ich mal posten aber für alles ist es etwas zu viel...
schonmal vorweg...
es sind 6 led strips, die sternförmig verdrahtet sind.
für mich intern sehe ich es als reihenverdrahtung und rechne das ganze mit folgenden funktionen in das sternförmige um:
int calculatePartForStar(int pixel)
{
int tempLength = 0;
for(int i=0; i<HALO_SIZE; i++)
{
tempLength += ledLengthArray[i];
if(tempLength >= pixel)
{
return i;
}
}
}
int calculatePxForStar(int pixel, int part)
{
int tempLength = 0;
int tempPixel = 0;
for(int i=0; i<part; i++)
{
tempLength += ledLengthArray[i];
}
tempPixel = pixel - tempLength;
return tempPixel-1;
}
in jedem loop wird dann beispielsweise folgende funktion aufgerufen:
void leftCometSolo()
{
if(cometIndex-totalLength < endComet)
{
cometIndex = cometIndex + cometSpeed;
for(int i=0; i<cometLength; i++)
{
paint(cometIndex-i, colors[infoWarningColor][0]-(i*((colors[infoWarningColor][0])/cometLength)), colors[infoWarningColor][1]-(i*((colors[infoWarningColor][1])/cometLength)), colors[infoWarningColor][2]-(i*((colors[infoWarningColor][2])/cometLength)));
}
for(int i=1; i<=cometSpeed; i++)
{
paint(cometIndex-cometLength - (cometSpeed-i), 0,0, 0);
}
clearOtherLeds(startComet, endComet-cometLength);
}
}
das zeichnen der pixel erfolgt hierüber:
void paint(int pixelPos, int r, int g, int b)
{
int part = calculatePartForStar(makeModulo(pixelPos));
int pixel = calculatePxForStar(makeModulo(pixelPos), part);
strips[part].setPixelColor(pixel, r*brightness/100, g*brightness/100, b*brightness/100);
}
void showStrip()
{
for(int i=0; i<6; i++)
{
strips[i].show();
}
}
für den überlauf in positiver oder negativer richtung ist dann das makeModulo zuständig...
hier dann noch paar variablendefinitionen:
#include "LPD8806.h"
#include "SPI.h"
#include "SimpleTimer.h"
int dataPin1 = 5;
int clockPin1 = 4;
int dataPin2 = 7;
int clockPin2 = 6;
int dataPin3 = 9;
int clockPin3 = 8;
int dataPin4 = 11;
int clockPin4 = 10;
int dataPin5 = 45;
int clockPin5 = 44;
int dataPin6 = 3;
int clockPin6 = 2;
int stripLengthv = 32;
int stripLengthvr = 16;
int stripLengthhr = 16;
int stripLengthh = 32;
int stripLengthhl = 16;
int stripLengthvl = 16;
LPD8806 strip1 = LPD8806(stripLengthv, dataPin1, clockPin1);
LPD8806 strip2 = LPD8806(stripLengthvr, dataPin2, clockPin2);
LPD8806 strip3 = LPD8806(stripLengthhr, dataPin3, clockPin3);
LPD8806 strip4 = LPD8806(stripLengthh, dataPin4, clockPin4);
LPD8806 strip5 = LPD8806(stripLengthhl, dataPin5, clockPin5);
LPD8806 strip6 = LPD8806(stripLengthvl, dataPin6, clockPin6);
LPD8806 strips[6] = {strip1, strip2, strip3, strip4, strip5, strip6};
#define HALO_SIZE 6
#define LED_PIN 13
und die setup funktion:
void setup()
{
Serial.flush();
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
for(int i=0; i<6; i++)
{
strips[i].begin();
strips[i].show();
}
clearAllLeds();
blinkTimerWall.setInterval(100, blinkWall);
Serial.flush();
}
der rest dürfte eigentlich nicht viel zur sache tun...hoffe ihr könnt mir helfen
Achso: delays sind außer der eine im loop (delay(2)) keine weiter drin...so ein comet braucht aber locker 2, 3 oder 4 sekunden um die runde von 128 LEDs komplett zu durchlaufen....geht doch sicher schneller oder?
hatte es in der not dann mit 2 und 3 pixel sprüngen in der for schleife versucht aber dann ist die animation sehr hakelig....