Your code with different comments
void loop() {
for(int i=0; i<NUM_LEDS; i++)
{
// set the colour of led[i]
leds[i] = CHSV(100, 255, 128);
// update ALL leds
FastLED.show();
// wait a bit
delay(50);
// change the color of led[i]
leds[i] = CHSV(100,255,100);
// update ALL leds
FastLED.show();
}
}
As you hopefully can see from the updated comments, you only update one led. If you want to update multiple leds at the same time, do not call show() after every change but wait till you have set all leds to the desired colour.
void loop() {
// set the colour of ALL leds
for(int i=0; i<NUM_LEDS; i++)
{
// set the colour of led[i]
leds[i] = CHSV(100, 255, 128);
}
// update ALL leds
FastLED.show();
// wait a bit
delay(50);
// set the colour of ALL leds
for(int i=0; i<NUM_LEDS; i++)
{
// change the color of led[i]
leds[i] = CHSV(100,255,100);
}
// update ALL leds
FastLED.show();
}
To change e.g. the value for a fading affect, you can use an additional variable and loop through that
void loop()
{
// loop through value
for(uint16_t value = 0; value < 255; value++)
{
// set the colour of ALL leds
for(int i=0; i<NUM_LEDS; i++)
{
// set the colour of led[i]
leds[i] = CHSV(100, 255, value);
}
// update ALL leds
FastLED.show();
// wait a bit
delay(50);
}
}
You can add other for-loops for hue and saturation, embedding the previously created for-loop in there so it looks as below
void loop()
{
for(uint16_t hue = 0; hue <255; hue++)
{
for(uint16_t sat = 0; sat <255; sat++)
{
for(uint16_t value = 0; value < 255; value++)
{
// set the colour of ALL leds
for(int i=0; i<NUM_LEDS; i++)
{
// set the colour of led[i]
leds[i] = CHSV(hue, sat, value);
}
// update ALL leds
FastLED.show();
// wait a bit
delay(50);
}
}
}
}
This will first loop through h=0, s=0, v=0..255. Next it will increment sat to 1 so loop through h=0, s=1, v=0..255, next increment sat again and loop though h=0, s=2, v=0..255. Once it has looped though all combinations of sat and value, it will increment hue and loop again through all combinations of sat and value.
Note that this will take very long (255x255x255x50).
If you want to keep your code responsive so you can e.g. immediately react on e.g. serial input or a button press, you will need a different approach and get rid of the delay.
The above should give you the idea.