yup yup! so I have 2 sketches.

yup yup!

so I have 2 sketches. both are fairly simple.

The first one monitors the audio signal with a “microphone sensor” and triggers an animation when the audio levels go over certain threshold. In this case the animation is a “moving led”, from the beggining to the end of the strip.

the second one sketch is an animation. A whole led strip fading in and out.

I would love to have a sketch in which the whole strips fades in and out, and when the audio levels go over certain threshold, the “moving led” apears in the game.

I really do not know how to combine this 2 behaviours without interrupting any of them…


sketch _01 - https://codeshare.io/2NreV

sketch _02 - https://codeshare.io/bu2u2

Say you fill a strip red, for example:
fill_solid( leds, NUM_LEDS, CRGB(255,0,0));
If you call show() at this point they will all display red. But you could re-assign some of them another color first before calling show(), such as:
for (i=3, i<7, i++) {
leds[i] = CRGB(0,0,255); // color blue
Now if you call show() all will be red except pixels 3 through 6 will be blue.

So to combine your scripts you’ll want to be constantly doing your fade in/out stuff, then check your audio and if triggered is true do your audio stuff, and then call show() at the end.

(Sorry if you got duplicate posts, my internet connection failed for a bit there.)

I use the switch case to switch between 2 display modes
If mic level above a value mode = 1
Else mode = 0
Switch ( mode)
Case 0 run fade sequence
Case 1 run move sequence

Switch case would be a good way to choose between the two but doesn’t allow for both visuals to display at the same time. If they don’t need to display at the same time though then it would probably be more efficient.

thanks guys for posting. I am away from computer a few days. will come back then. thanks again!