What you're asking still feels a bit vague. One pixel? Random pixels? The whole strip? Providing more info may get you better suggests with specific code. I would probably start by using random8 (or random16) or EVENY_N_MILLISECONDS_I or the new EVERY_N_MILLISECONDS_RANDOM to randomly choose when a flash will happen, and similarly for setting how long it will be dark.
Here's one example you can try modifying. See the example at lines 141-152 and modify the "on" and "off" times to use random8 or random16. Changing timingB.setPeriod(750) to timingB.setPeriod(random16(500,750)) for example.
If you make a copy of that block of code so you can use it on a different pixel you'll need to update the blink6 to blink7 (or another variable name) in four places. You'll also need to rename timingB in several places to whatever new name you want to call it.
2
u/Marmilicious [Marc Miller] Apr 30 '25 edited Apr 30 '25
What you're asking still feels a bit vague. One pixel? Random pixels? The whole strip? Providing more info may get you better suggests with specific code. I would probably start by using random8 (or random16) or EVENY_N_MILLISECONDS_I or the new EVERY_N_MILLISECONDS_RANDOM to randomly choose when a flash will happen, and similarly for setting how long it will be dark.
Here's one example you can try modifying. See the example at lines 141-152 and modify the "on" and "off" times to use random8 or random16. Changing timingB.setPeriod(750) to timingB.setPeriod(random16(500,750)) for example.
https://github.com/marmilicious/FastLED_examples/blob/master/blink_variations.ino
1
u/chemdoc77 Apr 30 '25
Hi u/Flux83 - this will do what you are trying to achieve when you make:
Line 95: CRGB gBackgroundColor = CRGB::Black; // to make led black after being on.
TwinkleFOX sketch:
https://gist.github.com/kriegsman/756ea6dcae8e30845b5a
It’s called TwinkleFOX by Mark Kriegsman. Checkout the various YouTube videos of it.
0
u/sutaburosu [stavros] Apr 30 '25
You could do this by changing the timing of the on/off periods with EVERY_N_MILLISECONDS_I, similar to what the sketch you posted previously does.