Is there a simple way to create a strobing effect?

fastled-support
gplus
(Kyle bostick) #1

Is there a simple way to create a strobing effect? What I would like to do is be able to adjust the speed of the flash, from a slow steady blink to a very fast blinking strobe. Also would like to be able to change the color

(Chris Parton) #2

Hi Kyle, something like this should do the trick. I don’t have an IDE in front of me at the moment, so there may be some errors but the essential logic is (hopefully) correct!

https://pastebin.com/g688UEVe

(Chris Parton) #3

I forgot FastLED.show() at the end of the loop function.

(Kyle bostick) #4

@Chris_Parton Thank you for taking the time to help me. I have tried to add your code to a really basic sketch so I can understand it before trying to add it to my more advanced sketch, but I am getting some errors I am not able to figure out. I am posting a link to my more advanced sketch which is working without errors, but I would like to add the strobe effect into my sketch and have no idea how to do it. Here is a link, would you mind adding the strobe to this for me? Preferably between lines 670-780

(Chris Parton) #5

Were you getting compilation errors? I didn’t have a chance to test that code before I sent it to you. If I have a bit of time tonight I’ll see what I can do for you, no promises though :wink:

(Chris Parton) #6

I’ve had a go at integrating it into your code (and simplified my strobe code too), but I can’t compile it because I don’t have all your libraries set up.

Here’s the new code for you to try: https://pastebin.com/u2Hnzvru

And here’s a diff so you can see exactly what I changed: https://www.diffchecker.com/wgWXUNVs

(Kyle bostick) #7

Omg Thank you this is awesome! I uploaded it, and it works without any errors! I see where I can change the flash, and color in the arduino sketch but Is it possible to modify it so that my Home Assistant will be able to adjust the color and speed of the flash? The arduino code has a section for setting animation speed, and set color. If the code could be modified to be adjusted without having to keep changing the arduino code that would be perfect.

(Chris Parton) #8

I’m glad that it worked :slight_smile: I don’t have enough spare time to look at that modification sorry! You’ll have to have a crack at it yourself and come back with any specific issues.

(Kyle bostick) #9

@Chris_Parton Thank you, heres it in action.