I Have a problem with a project I have a led strip with 178

(Kim Cajus) #1

I Have a problem with a project I have a led strip with 178 ws2811 ( connected to a arduino uno) I want them all to have the same brightness/color 32,0,32. then I want the led s randomly increase brightness to 64,0,64 for a short moment and fade back to 32,0,32.
I am a newbie with this kind of coding. Been looking at different Fastled sketches and examples. Can somebody help me ???

(Andrew Tuline) #2

What does 32, 0, 32 or 64, 0, 64 stand for? RGB? HSV? Where is your current code (on pastebin)? Is this a one time event? Is it a recurring event?

(Daniel Garcia) #3

Given that brightness was mentioned, I’m assuming those are RGB values. I threw together a quick gist that shows off one way of doing something like this - https://gist.github.com/focalintent/064d517982656d68b326

(Kim Cajus) #4

Sorry It RGB it is recurring event

(Andrew Tuline) #5

Do you want your random LED’s to slowly fade in/out those values or to just change to the new value? The former takes more effort.

(Kim Cajus) #6

Yes Thank U big time. That,s more or less it. How can I make the fade from 32,0,32 to 64,0,64 as smooth as the down fade

(Marc Miller) #7

Here’s something I put together awhile back that kind of has a bit of what you’re looking for. Maybe it can help give you some ideas for your project.

(Kim Cajus) #8

I would like them to slowly fade in and out

(Kim Cajus) #9

Thank`s Marc

(Kim Cajus) #10

Thank,s to all of U for your help I really appreciate it

(Mark Kriegsman) #11

Take a look at this sketch, and try just loading it with just the colors that you want. The “slow twinkle” might be what you want here. In any case, take a look. https://gist.github.com/kriegsman/5408ecd397744ba0393e

(Kim Cajus) #12

Thanks Mark . Ill have a look at it. It might solve my problem :slight_smile:

(Kim Cajus) #13


Hi Mark how can i set the colors to 32,0,32 (RGB) instead of fading to black and then just fade up to 64,0,64. and back to 32,0,32 . Regards

(Marc Miller) #14

@Kim_Cajus Did you try out Daniel’s example above? It will not fade all the way to black.

(Kim Cajus) #15


No but the thing that I need smooth fade both up and down, I ve been looking at different opportunities both the one Daniel sent and Mark Kriegsman and your´s, but I am kind of lost, This project was given to me by my boss so I am all new to Arduino etc, and my understanding of the code is still rather limited when it comes to color wheel fade steps functions and so on

(Mark Kriegsman) #16

I’ll see if I can come up with better example code, but you need to think about it in tiny, simple steps. Perhaps this helps:

Each pixel is in one of three states:
A. steady dim
B. getting brighter
C. getting dimmer again

So in addition to the ‘current color’ that is stored for each pixel, you need a separate array that also stores the ‘state’ for each pixel. Then you can write pretty simple code that does this:

When a pixel is steady dim,

  • sometimes it randomly switches to getting brighter
  • otherwise, it just sits there dim ( no change)

When a pixel is getting brighter,

  • if it’s at maximum brightness, then it switches to ‘getting dimmer again’
  • otherwise, increment the brightness

When a pixel is getting dimmer again,

  • if it’s at minimum brightness, then it switches to ‘steady dim’
  • otherwise, decrement the brightness

This is similar to what the Color Twinkle code does. Take another look at it, and I will, too, to see if I can offer other tips.

(Mark Kriegsman) #17

Take a look at this brand new code that I put together to show as an example of how this might work for you: