RGB LED strip 1 Color dimming

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(); 
                			
    }

You’re just telling us it don’t work and don’t supply full code, it’s not easy to help you…

If the rest of the code works like I imagine, the first version of your code will fade as you like but because you’re using the upper value 384 and not 256, you may get strange results. Depending on the timing of the rest of the code the fading may be so fast you won’t see it but just a dimmed light as output. You see, without the full code there’s a lot of imagination necessary to give you an interpretation.

Hey,

You see nearly the full code, I just setup my strip and stuff and in void loop I just call the function posted before. Like I always test things in the shortest way before implementing it in my whole project.

OK I will test the 256 instead of the 384 thing. Will be back tomorrow with the results ...

THANKS so far !