Moin,
ich will in meinem Gaming Zimmer die Ultimative RGB Beleuchtung haben, deshalb habe ich mir 15 Meter WS2818 also Neopixels bestellt und verlegt (Unter Tischen, in Schränken, an Monitoren usw.)
Ziel dieses Projektes ist jeden einzelnen Strip in eigenem RGB-Verlauf-Rhythmus durchlaufen zu lassen.
Ein Netzteil mit 5V 60A also 300W wird die LEDs versorgen (Müsste nach meinen Berechnungen ausreichen)
Ich habe 15 Stripes Insgesamt verlegt, welche jedoch logisch zusammengefasst (Weil manche zb Übereinander sind und dieselben Animationen brauchen) 10 Stripes sind.
Hier die Anzahl von LEDs der verschiedenen Stripes:
Stripe 1: 65 LEDs
Stripe 2: 44 LEDs
Stripe 3: 75 LEDs
Stripe 4: 28 LEDs
Stripe 5: 52 LEDs
Stripe 6: 22 LEDs
Stripe 7: 102 LEDs
Stripe 8: 92 LEDs
Stripe 9: 124 LEDs
Stripe 10: 121 LEDs
Da ich nicht sehr gut im Coden bin habe ich mir diesen Code auf einer Website erstellt. Jedoch weis ich nicht ob dieser funktionieren würde, vielleicht könnt ihr mir da weiterhelfen.
#include <Adafruit_NeoPixel.h>
class Strip
{
public:
uint8_t effect;
uint8_t effects;
uint16_t effStep;
unsigned long effStart;
Adafruit_NeoPixel strip;
Strip(uint16_t leds, uint8_t pin, uint8_t toteffects, uint16_t striptype) : strip(leds, pin, striptype) {
effect = -1;
effects = toteffects;
Reset();
}
void Reset(){
effStep = 0;
effect = (effect + 1) % effects;
effStart = millis();
}
};
struct Loop
{
uint8_t currentChild;
uint8_t childs;
bool timeBased;
uint16_t cycles;
uint16_t currentTime;
Loop(uint8_t totchilds, bool timebased, uint16_t tottime) {currentTime=0;currentChild=0;childs=totchilds;timeBased=timebased;cycles=tottime;}
};
Strip strip_0(65, 2, 65, NEO_GRB + NEO_KHZ800);
Strip strip_1(44, 3, 44, NEO_GRB + NEO_KHZ800);
Strip strip_2(75, 4, 75, NEO_GRB + NEO_KHZ800);
Strip strip_3(28, 5, 28, NEO_GRB + NEO_KHZ800);
Strip strip_4(52, 6, 52, NEO_GRB + NEO_KHZ800);
Strip strip_5(22, 7, 22, NEO_GRB + NEO_KHZ800);
Strip strip_6(102, 8, 102, NEO_GRB + NEO_KHZ800);
Strip strip_7(92, 9, 92, NEO_GRB + NEO_KHZ800);
Strip strip_8(124, 10, 124, NEO_GRB + NEO_KHZ800);
Strip strip_9(121, 11, 121, NEO_GRB + NEO_KHZ800);
struct Loop strip0loop0(1, false, 1);
struct Loop strip1loop0(1, false, 1);
struct Loop strip2loop0(1, false, 1);
struct Loop strip3loop0(1, false, 1);
struct Loop strip4loop0(1, false, 1);
struct Loop strip5loop0(1, false, 1);
struct Loop strip6loop0(1, false, 1);
struct Loop strip7loop0(1, false, 1);
struct Loop strip8loop0(1, false, 1);
struct Loop strip9loop0(1, false, 1);
//[GLOBAL_VARIABLES]
void setup() {
//Your setup here:
strip_0.strip.begin();
strip_1.strip.begin();
strip_2.strip.begin();
strip_3.strip.begin();
strip_4.strip.begin();
strip_5.strip.begin();
strip_6.strip.begin();
strip_7.strip.begin();
strip_8.strip.begin();
strip_9.strip.begin();
}
void loop() {
//Your code here:
strips_loop();
}
void strips_loop() {
if(strip0_loop0() & 0x01)
strip_0.strip.show();
if(strip1_loop0() & 0x01)
strip_1.strip.show();
if(strip2_loop0() & 0x01)
strip_2.strip.show();
if(strip3_loop0() & 0x01)
strip_3.strip.show();
if(strip4_loop0() & 0x01)
strip_4.strip.show();
if(strip5_loop0() & 0x01)
strip_5.strip.show();
if(strip6_loop0() & 0x01)
strip_6.strip.show();
if(strip7_loop0() & 0x01)
strip_7.strip.show();
if(strip8_loop0() & 0x01)
strip_8.strip.show();
if(strip9_loop0() & 0x01)
strip_9.strip.show();
}
uint8_t strip0_loop0() {
uint8_t ret = 0x00;
switch(strip0loop0.currentChild) {
case 0:
ret = strip0_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip0loop0.currentChild + 1 >= strip0loop0.childs) {
strip0loop0.currentChild = 0;
if(++strip0loop0.currentTime >= strip0loop0.cycles) {strip0loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip0loop0.currentChild++;
}
};
return ret;
}
uint8_t strip0_loop0_eff0() {
// Strip ID: 0 - Effect: Rainbow - LEDS: 65
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_0.effStart < 20 * (strip_0.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<65;j++) {
ind = strip_0.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_0.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_0.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_0.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_0.effStep >= 60) {strip_0.Reset(); return 0x03; }
else strip_0.effStep++;
return 0x01;
}
uint8_t strip1_loop0() {
uint8_t ret = 0x00;
switch(strip1loop0.currentChild) {
case 0:
ret = strip1_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip1loop0.currentChild + 1 >= strip1loop0.childs) {
strip1loop0.currentChild = 0;
if(++strip1loop0.currentTime >= strip1loop0.cycles) {strip1loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip1loop0.currentChild++;
}
};
return ret;
}
uint8_t strip1_loop0_eff0() {
// Strip ID: 1 - Effect: Rainbow - LEDS: 44
// Steps: 44 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=44, toLeft=true,
if(millis() - strip_1.effStart < 20 * (strip_1.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<44;j++) {
ind = strip_1.effStep + j * 1;
switch((int)((ind % 44) / 14.666666666666666)) {
case 0: factor1 = 1.0 - ((float)(ind % 44 - 0 * 14.666666666666666) / 14.666666666666666);
factor2 = (float)((int)(ind - 0) % 44) / 14.666666666666666;
strip_1.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 44 - 1 * 14.666666666666666) / 14.666666666666666);
factor2 = (float)((int)(ind - 14.666666666666666) % 44) / 14.666666666666666;
strip_1.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 44 - 2 * 14.666666666666666) / 14.666666666666666);
factor2 = (float)((int)(ind - 29.333333333333332) % 44) / 14.666666666666666;
strip_1.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_1.effStep >= 44) {strip_1.Reset(); return 0x03; }
else strip_1.effStep++;
return 0x01;
}
uint8_t strip2_loop0() {
uint8_t ret = 0x00;
switch(strip2loop0.currentChild) {
case 0:
ret = strip2_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip2loop0.currentChild + 1 >= strip2loop0.childs) {
strip2loop0.currentChild = 0;
if(++strip2loop0.currentTime >= strip2loop0.cycles) {strip2loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip2loop0.currentChild++;
}
};
return ret;
}
uint8_t strip2_loop0_eff0() {
// Strip ID: 2 - Effect: Rainbow - LEDS: 75
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_2.effStart < 20 * (strip_2.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<75;j++) {
ind = strip_2.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_2.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_2.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_2.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_2.effStep >= 60) {strip_2.Reset(); return 0x03; }
else strip_2.effStep++;
return 0x01;
}
uint8_t strip3_loop0() {
uint8_t ret = 0x00;
switch(strip3loop0.currentChild) {
case 0:
ret = strip3_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip3loop0.currentChild + 1 >= strip3loop0.childs) {
strip3loop0.currentChild = 0;
if(++strip3loop0.currentTime >= strip3loop0.cycles) {strip3loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip3loop0.currentChild++;
}
};
return ret;
}
uint8_t strip3_loop0_eff0() {
// Strip ID: 3 - Effect: Rainbow - LEDS: 28
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_3.effStart < 20 * (strip_3.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<28;j++) {
ind = strip_3.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_3.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_3.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_3.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_3.effStep >= 60) {strip_3.Reset(); return 0x03; }
else strip_3.effStep++;
return 0x01;
}
uint8_t strip4_loop0() {
uint8_t ret = 0x00;
switch(strip4loop0.currentChild) {
case 0:
ret = strip4_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip4loop0.currentChild + 1 >= strip4loop0.childs) {
strip4loop0.currentChild = 0;
if(++strip4loop0.currentTime >= strip4loop0.cycles) {strip4loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip4loop0.currentChild++;
}
};
return ret;
}
uint8_t strip4_loop0_eff0() {
// Strip ID: 4 - Effect: Rainbow - LEDS: 52
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_4.effStart < 20 * (strip_4.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<52;j++) {
ind = strip_4.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_4.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_4.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_4.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_4.effStep >= 60) {strip_4.Reset(); return 0x03; }
else strip_4.effStep++;
return 0x01;
}
uint8_t strip5_loop0() {
uint8_t ret = 0x00;
switch(strip5loop0.currentChild) {
case 0:
ret = strip5_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip5loop0.currentChild + 1 >= strip5loop0.childs) {
strip5loop0.currentChild = 0;
if(++strip5loop0.currentTime >= strip5loop0.cycles) {strip5loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip5loop0.currentChild++;
}
};
return ret;
}
uint8_t strip5_loop0_eff0() {
// Strip ID: 5 - Effect: Rainbow - LEDS: 22
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_5.effStart < 20 * (strip_5.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<22;j++) {
ind = strip_5.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_5.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_5.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_5.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_5.effStep >= 60) {strip_5.Reset(); return 0x03; }
else strip_5.effStep++;
return 0x01;
}
uint8_t strip6_loop0() {
uint8_t ret = 0x00;
switch(strip6loop0.currentChild) {
case 0:
ret = strip6_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip6loop0.currentChild + 1 >= strip6loop0.childs) {
strip6loop0.currentChild = 0;
if(++strip6loop0.currentTime >= strip6loop0.cycles) {strip6loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip6loop0.currentChild++;
}
};
return ret;
}
uint8_t strip6_loop0_eff0() {
// Strip ID: 6 - Effect: Rainbow - LEDS: 102
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_6.effStart < 20 * (strip_6.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<102;j++) {
ind = strip_6.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_6.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_6.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_6.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_6.effStep >= 60) {strip_6.Reset(); return 0x03; }
else strip_6.effStep++;
return 0x01;
}
uint8_t strip7_loop0() {
uint8_t ret = 0x00;
switch(strip7loop0.currentChild) {
case 0:
ret = strip7_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip7loop0.currentChild + 1 >= strip7loop0.childs) {
strip7loop0.currentChild = 0;
if(++strip7loop0.currentTime >= strip7loop0.cycles) {strip7loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip7loop0.currentChild++;
}
};
return ret;
}
uint8_t strip7_loop0_eff0() {
// Strip ID: 7 - Effect: Rainbow - LEDS: 92
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_7.effStart < 20 * (strip_7.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<92;j++) {
ind = strip_7.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_7.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_7.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_7.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_7.effStep >= 60) {strip_7.Reset(); return 0x03; }
else strip_7.effStep++;
return 0x01;
}
uint8_t strip8_loop0() {
uint8_t ret = 0x00;
switch(strip8loop0.currentChild) {
case 0:
ret = strip8_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip8loop0.currentChild + 1 >= strip8loop0.childs) {
strip8loop0.currentChild = 0;
if(++strip8loop0.currentTime >= strip8loop0.cycles) {strip8loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip8loop0.currentChild++;
}
};
return ret;
}
uint8_t strip8_loop0_eff0() {
// Strip ID: 8 - Effect: Rainbow - LEDS: 124
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_8.effStart < 20 * (strip_8.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<124;j++) {
ind = strip_8.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_8.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_8.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_8.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_8.effStep >= 60) {strip_8.Reset(); return 0x03; }
else strip_8.effStep++;
return 0x01;
}
uint8_t strip9_loop0() {
uint8_t ret = 0x00;
switch(strip9loop0.currentChild) {
case 0:
ret = strip9_loop0_eff0();break;
}
if(ret & 0x02) {
ret &= 0xfd;
if(strip9loop0.currentChild + 1 >= strip9loop0.childs) {
strip9loop0.currentChild = 0;
if(++strip9loop0.currentTime >= strip9loop0.cycles) {strip9loop0.currentTime = 0; ret |= 0x02;}
}
else {
strip9loop0.currentChild++;
}
};
return ret;
}
uint8_t strip9_loop0_eff0() {
// Strip ID: 9 - Effect: Rainbow - LEDS: 121
// Steps: 60 - Delay: 20
// Colors: 3 (255.0.0, 0.255.0, 0.0.255)
// Options: rainbowlen=60, toLeft=true,
if(millis() - strip_9.effStart < 20 * (strip_9.effStep)) return 0x00;
float factor1, factor2;
uint16_t ind;
for(uint16_t j=0;j<121;j++) {
ind = strip_9.effStep + j * 1;
switch((int)((ind % 60) / 20)) {
case 0: factor1 = 1.0 - ((float)(ind % 60 - 0 * 20) / 20);
factor2 = (float)((int)(ind - 0) % 60) / 20;
strip_9.strip.setPixelColor(j, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2);
break;
case 1: factor1 = 1.0 - ((float)(ind % 60 - 1 * 20) / 20);
factor2 = (float)((int)(ind - 20) % 60) / 20;
strip_9.strip.setPixelColor(j, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2, 0 * factor1 + 255 * factor2);
break;
case 2: factor1 = 1.0 - ((float)(ind % 60 - 2 * 20) / 20);
factor2 = (float)((int)(ind - 40) % 60) / 20;
strip_9.strip.setPixelColor(j, 0 * factor1 + 255 * factor2, 0 * factor1 + 0 * factor2, 255 * factor1 + 0 * factor2);
break;
}
}
if(strip_9.effStep >= 60) {strip_9.Reset(); return 0x03; }
else strip_9.effStep++;
return 0x01;
}
Ich habe mir auch noch keinen Arduino gekauft und bin mir unsicher welchen ich nehmen soll.
Bei manchen Beiträgen steht das die Arduinos nicht unbedingt einen PWM Pin verwenden muss, da dies die eingebauten ICs der Neopixel übernehmen.
In diesem Fall würde ich mir einen Arduino Nano oder Arduino Uno kaufen.
Sollte das aber nicht stimmen würde ich mir den ATMega 2560kaufen welcher genügen PWM Pins hat.
Ich danke im Voraus für eure Hilfe,
LG
~M