0

I have a lamp based on Arduino with moving rainbow effect via FastLED library.

The code is:

  void rainbow(){
    hue += 2;
    for (int i = 0; i < NUM_LEDS; i++)
      leds[i] = CHSV((byte)(hue + i * float(255 / NUM_LEDS)), 255, 255);
  }

So I don't really like blue gradient in my rainbow so I'd like to remove it (i guess it's from 135 to 180).

Juraj
  • 3,490
  • 4
  • 18
  • 25

1 Answers1

0

Following assumes you're a rational individual that's cool with purple and aqua, but doesn't like blue to dominate

Curious what you end up doing. General info at the following was interesting.

https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors https://github.com/FastLED/FastLED/wiki/Pixel-reference

Maybe convert to RGB, suppress B to not be more than R or G, then use as is (rgbNew) or convert to HSV again (hsvNew) depending on what you're doing.

CRGB rgb;
hsv2rgb_rainbow(hsv, rgb);  // or hsv2rgb_spectrum maybe
long minBlue = min(max(rgb.r, rgb.g), rgb.b);
CRGB rgbNew =  ((long)rgb.r << 16L) | ((long)rgb.g << 8L) | (long)minBlue;
CHSV hsvNew = rgb2hsv_approximate(rgbNew);