I am trying to create an animation where I shift the current hue of

I am trying to create an animation where I shift the current hue of every LED in my matrix, little by little. Based on the documentation, I figured something like this should work (the sample was for CRGB, but I figured this would work the same - maybe not?), but I didn’t see any change. Am I missing something?

	for (int c = 0; c < 50; c++)
	{
		for (int l = 0; l < NUM_LEDS; l++)
		{
			leds[l] += CHSV(1, 0, 0);
		}

		FastLED.show();
		delay(10);
	}

You know, if the underlying led data was HSV, that’d work. But since the underlying led data is RGB, it doesn’t. (In the glorious future it may someday be otherwise, but that day is not today.)

Today, there’s no built in function to go from RGB to HSV, which is what you’d want. Then you could do something like this:
CHSV hsv = leds[i]; // RGB to HSV
hsv.hue ++; // increment hue
leds[i] = hsv; // HSV to RGB

Unfortunately, the first step doesn’t work at this point.

You might want to consider keeping a separate, parallel array in which you record the hue you’ve stored in each pixel,
uint8_t hue[NUM_LEDS];
and keep it updated to that hue[i] is the current hue of that pixel. The you could
hue[i] ++;
leds[i] = CHSV( hue[i], 255,255);

Or if you wish, you could keep an array of CHSVs, one for each pixel
CHSV hsvleds[NUM_LEDS];
and use
hsv2rgb_rainbow( hsvleds, leds, NUM_LEDS);
to convert the whole array before calling FastLED.show();

Any if this help?

(See also https://plus.google.com/app/basic/stream/z13shl2qpti4hj2xa04cellxvx2mgpugavw0k )

All of that is very helpful - thanks Mark! :slight_smile: I’m about to eat dinner and then be out for a while, but I’ll give your methods a try later on tonight.

I especially appreciate the link to the earlier post. I am still working my way through the community with the intent of reading every post, but so far (going backwards in time), I’m only back to about November 30th. I’ve already found a number of good posts though. :slight_smile:

Thanks! I feel like we should have a “Best Of…” page of links somewhere… hrm.

I feel compelled to say that the library is great, but the level of support that both you and Daniel provide is amazing! Well done. :slight_smile:

Top that off with a very friend and helpful G+ community, and it makes for a very nice experience. I only hope that as my skills progress, I can start giving some help back.