# What's the easiest way to light a sine wave of a specific RGB or

What’s the easiest way to light a sine wave of a specific RGB or HSV color? I like how this looks but instead of controlling red, blue and green individually I want to have a specific color moving.

void plas3() {

``````wave1 +=2;
wave2 +=1;
wave3 -=3;
for (int k=0; k<NUM_LEDS; k++) {
leds[k].r = qsub(sin8(20*k + wave1), 80);									 // Another fixed frequency, variable phase sine wave with lowered level
leds[k].g = qsub(cos8(25*k + wave2), 80);									 // A fixed frequency, variable phase sine wave with lowered level
leds[k].b = qsub(sin8(22*k + wave3), 80);									 // A fixed frequency, variable phase sine wave with lowered level
}
LEDS.show();
delay(thisdelay);
``````

}

Paging @Andrew_Tuline

I wrote that pre-palette days. You have a few options here and since you’re getting an 8 bit value, you could use HSV and say:

uint8_t val = qsub(sin8(20*k + wave1), 80);
leds[k] = CHSV(val, 255, 255);

You could also use palettes (which is what I do these days) and:

uint8_t val = qsub(sin8(20*k + wave1), 80);
leds[i] = ColorFromPalette(currentPalette, val, brightness, currentBlending);

So, I’d just play around and try different things. Also, don’t forget to read colorutils.h and lib8tion.h for more fun with functions.

Here’s another example to give you ideas.

Mark’s got some great examples on github.

Had this saved in a notes file also. Change beatsin16 to other wave functions to experiment.

// Moving “Cylon” dot with fading motion blurred trails: