Explain: a line about LED strip

hi i have a little problem i don´t understand what this line does
leds = CHSV(i - (j * 2), BRIGHTNESS, SATURATION);
*the full code: *
*#include <FastLED.h>

#define NUM_LEDS 60      /* The amount of pixels/leds you have /
#define DATA_PIN 7      /
The pin your data line is connected to /
#define LED_TYPE WS2812B /
I assume you have WS2812B leds, if not just change it to whatever you have /
#define BRIGHTNESS 255  /
Control the brightness of your leds /
#define SATURATION 255  /
Control the saturation of your leds */


void setup() {
  FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);

void loop() {
  for (int j = 0; j < 255; j++) {
    for (int i = 0; i < NUM_LEDS; i++) {
      leds[i] = CHSV(i - (j * 2), BRIGHTNESS, SATURATION);
    delay(25); /* Change this to your hearts desire, the lower the value the faster your colors move (and vice versa) /


HSV is Hue, Saturation and Value (Brightness) - an alternative to RGB if you like.
The CHSV function calculates the representation for a HSV value to store in leds Check the definition of leds if you need to.

I believe the BRIGHTNESS and SATURATION are the wrong way round in that call, however since both are specified as 255 it probably means you will see no difference.

Have a look at FastLED: CHSV Struct Reference

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.