Problem with diode control via HSV

Welcome,
I have a problem with the control of the LEDs. I have tried Adafruit NeoPixel and FastLed. The problem only occurs with HSV.
My code:

#include <FastLED.h>

#define LED_PIN     6
#define COLOR_ORDER GRB
#define CHIPSET     WS2812B
#define NUM_LEDS    30

CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop(){
  for(int i=0;i < 61; i++){
    leds[i] = CRGB(255,0,0);
  }
  FastLED.show();
  delay(1000);
}

RGB is ok:

leds[i] = CRGB(255,0,0);
leds[i] = CRGB(0,255,0);
leds[i] = CRGB(0,0,255);

1a

HSV looks like this:

leds[i] = CHSV(0,255,255);
leds[i] = CHSV(120,255,255);
leds[i] = CHSV(240,255,255);
leds[i] = CHSV(359,255,255);

2a

Please help, I have already spent some time and found nothing. I have tried combinations of RGB, GRB, BGR etc. What am I still doing wrong?

Did you read the FastLED documentation?

the FastLED library uses simple one-byte values (from 0-255) for hue, and for saturation, and for value.

Ok, in that case it's not quite HSV. H is expressed in degrees 0-360° :slight_smile: Thanks a lot, I thought for a long time what I did wrong :slight_smile: Thank you very much and best regards!

That may have been your expectation. But, if you had read the FastLED documentation, you would have seen that angles are scaled for 0-255 so they fit in a byte (faster). Also, functions like sine, cosine, etc return a value in 0-255 range for the same reason.

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