Hello there,
I wonder how it works to just simply dim my rgb strip in 1 Color. For example i want to have a blinking signal (2s on - 2s off ... ) and I want this to fadein and fadeout. I tried already a lot, all I can find in the internet is color fading (between different colors), I tried to change the code for that but still don´t work at all. My problem now is, that i have no chance to control the on/off time.
Im using a Seeeduino, with an LPD8806 LED RGB Strip
Maybe someone of you knows hot to fix that problem. This is the last step to get my whole program like I wanted it.
Best Regards Mia
in loop i call it just with: rainbow(0); // if wait time is used (wait => 5) , you can see how th elight strip gets filled pixel by pixel
void rainbow(uint8_t wait) {
int i, j;
for (j=0; j < 384; j++) { // 3 cycles of all 384 colors in the wheel
for (i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel( (i + j) % 384));
}
strip.show(); // write all the pixels out
}
}
/* Helper functions */
//Input a value 0 to 384 to get a color value.
//The colours are a transition r - g -b - back to r
uint32_t Wheel(uint16_t WheelPos)
{
byte r, g, b;
switch(WheelPos / 128) //128 / 127
{
case 0:
b = 0; //blue off
r = WheelPos % 128; //red up
g = 0; //green off
break;
case 1:
r = 127 - WheelPos % 128; //Red down
g = 0; // Green off
b = 0; //blue off
break;
}
return(strip.Color(r,g,b));
}
This is the normal code i use for blinking, may its possible to get a fading function in there.
void sameColorBlink(uint32_t c, int wait)
{ Serial.print("sameColorBlink ");
Serial.println(wait);
if (wait != 0)
{ Serial.print("wait > 0, blink ");
for (int i=0; i < firstStrip.numPixels(); i++)
{
firstStrip.setPixelColor(i, 0); // turn all pixels off
}
firstStrip.show();
}
delay(wait);
for (int i=0; i < firstStrip.numPixels(); i++)
{
firstStrip.setPixelColor(i, c);
}
firstStrip.show();
delay(wait);
Serial.println(wait);
readModeStatus();
}