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:wink:

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:
fadeToBlackBy( leds, NUM_LEDS, 20); //fade by 7.8% (20/256th)
int pos = beatsin16(13,0,NUM_LEDS);
leds[pos] = CRGB::Blue;

And here’s a sin cheatsheet which always makes it easier to remember what to adjust.

Here’s my notes file:

http://tuline.com/some-fastled-notes/

anyone got a good site/page that lays out sine waves as they apply to this sort of thing in layman’s terms. I’ve had a hard time wrapping my head around it and what it actually does and I get the feeling older projects of mine could have benefitted from using the math.