user77985: I am working on a led strip project and was looking for ways to smooth transition from color to another. Problem is my current method is not so good.
#include <Adafruit_NeoPixel.h>


#define LED_PIN     25
#define LED_COUNT  60
#define BRIGHTNESS 50


Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);

bool isFading = false;
unsigned long startTime;
uint32_t fadeDuration = 1000;          //fade for 3seconds
uint32_t startingColor = 0x00ffff00;      // W = 0x00 R=0xFF G=0xFF B=0x00  yellow
uint32_t targetColor = 0x008f00ff;        // W = 0x00 R=0x8F G=0x00 B=0xff  violet

void setup() {

  pinMode(25, OUTPUT);
  digitalWrite(25, LOW);

    Serial.begin(9600);
  while (!Serial);
  Serial.println("Starting");
  
  strip.begin();
  strip.show();
  strip.setBrightness(BRIGHTNESS);

  

  for (int i = 0; i < strip.numPixels(); i++)
    strip.setPixelColor(i, startingColor);
  strip.show();

  delay(5000); // wait 5 seconds before fading



  isFading = true;
  startTime = millis();
}



void loop() {


  if (isFading) { //Fade from yellow to violet in 3 seconds
    for (int i = 0; i < strip.numPixels(); i++)
      strip.setPixelColor(i, getFadeColor(startingColor, targetColor, startTime, startTime + fadeDuration));
    strip.show();
  }

  if ( millis() >= startTime + fadeDuration){; // i intentionally did not include an overflow check to keep it simple
  Serial.println("Fade ended");
  isFading = false;
  }
}


uint32_t getFadeColor(uint32_t startColor, uint32_t endColor, unsigned long timeStart, unsigned long timeEnd) {

  uint8_t startWhite  = (startColor >> 24) & 0xff;
  uint8_t startRed    = (startColor >> 16) & 0xff;
  uint8_t startGreen  = (startColor >> 8 ) & 0xff;
  uint8_t startBlue    =  startColor & 0xff;

  uint8_t endWhite    = (endColor >> 24) & 0xff;
  uint8_t endRed      = (endColor >> 16) & 0xff;
  uint8_t endGreen    = (endColor >> 8) & 0xff;
  uint8_t endBlue      = endColor & 0xff;

  unsigned long timeNow = millis();

  uint8_t mapTime = map(timeNow, timeStart, timeEnd, 0, 255);
  uint8_t white   = map(mapTime, 0, 255, startWhite, endWhite);
  uint8_t red     = map(mapTime, 0, 255, startRed, endRed);
  uint8_t green   = map(mapTime, 0, 255, startGreen, endGreen);
  uint8_t blue    = map(mapTime, 0, 255, startBlue, endBlue);

  Serial.print("Time: \t");
  Serial.print(mapTime);
  Serial.print('\t');
  Serial.print("Color now: \t");
  Serial.println(strip.Color(  red,   green,   blue, white),HEX);

  return strip.Color(  red,   green,   blue, white);

}

The problem im having with this code is visually it would seem that it goes from
Yellow -> White -> violet
and it does not look like a proper transition. I have tried with other colors, and it always seems to pass throught the white color
Are there color theories i can apply for the transition? if you can show me an example sketches on how to do the transition that would also be great.

user42015: 
something that will go through the color wheel until the destination color

For that the FastLED library has the function ColorHSV(), which can be used to define colors using the HSV color space. It stands for Hue, Saturation and Value (or brightness). Hue is the value representing the position in the color wheel, so that is what you want to change.
Instead of
strip.Color(  red,   green,   blue, white);

use
strip.ColorHSV( hue, saturation, brightness );

and change hue over time with the algorithm, that you already programmed. When saturation and brightness stay the same the LEDs will cycle through the color wheel.
Note: The library provides the way from HSV to RGB color (with the above function), but it does not provide a way back. For getting back HSV from an RGB color you would need to write your own conversion function and I don't know how to do that. Though at the current state you don't need it.

77985: <p>I am working on a led strip project and was looking for ways to smooth transition from color to another. Problem is my current method is not so good.</p>
<pre><code>#include &lt;Adafruit_NeoPixel.h&gt;


#define LED_PIN     25
#define LED_COUNT  60
#define BRIGHTNESS 50


Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);

bool isFading = false;
unsigned long startTime;
uint32_t fadeDuration = 1000;          //fade for 3seconds
uint32_t startingColor = 0x00ffff00;      // W = 0x00 R=0xFF G=0xFF B=0x00  yellow
uint32_t targetColor = 0x008f00ff;        // W = 0x00 R=0x8F G=0x00 B=0xff  violet

void setup() {

  pinMode(25, OUTPUT);
  digitalWrite(25, LOW);

    Serial.begin(9600);
  while (!Serial);
  Serial.println(&quot;Starting&quot;);
  
  strip.begin();
  strip.show();
  strip.setBrightness(BRIGHTNESS);

  

  for (int i = 0; i &lt; strip.numPixels(); i++)
    strip.setPixelColor(i, startingColor);
  strip.show();

  delay(5000); // wait 5 seconds before fading



  isFading = true;
  startTime = millis();
}



void loop() {


  if (isFading) { //Fade from yellow to violet in 3 seconds
    for (int i = 0; i &lt; strip.numPixels(); i++)
      strip.setPixelColor(i, getFadeColor(startingColor, targetColor, startTime, startTime + fadeDuration));
    strip.show();
  }

  if ( millis() &gt;= startTime + fadeDuration){; // i intentionally did not include an overflow check to keep it simple
  Serial.println(&quot;Fade ended&quot;);
  isFading = false;
  }
}


uint32_t getFadeColor(uint32_t startColor, uint32_t endColor, unsigned long timeStart, unsigned long timeEnd) {

  uint8_t startWhite  = (startColor &gt;&gt; 24) &amp; 0xff;
  uint8_t startRed    = (startColor &gt;&gt; 16) &amp; 0xff;
  uint8_t startGreen  = (startColor &gt;&gt; 8 ) &amp; 0xff;
  uint8_t startBlue    =  startColor &amp; 0xff;

  uint8_t endWhite    = (endColor &gt;&gt; 24) &amp; 0xff;
  uint8_t endRed      = (endColor &gt;&gt; 16) &amp; 0xff;
  uint8_t endGreen    = (endColor &gt;&gt; 8) &amp; 0xff;
  uint8_t endBlue      = endColor &amp; 0xff;

  unsigned long timeNow = millis();

  uint8_t mapTime = map(timeNow, timeStart, timeEnd, 0, 255);
  uint8_t white   = map(mapTime, 0, 255, startWhite, endWhite);
  uint8_t red     = map(mapTime, 0, 255, startRed, endRed);
  uint8_t green   = map(mapTime, 0, 255, startGreen, endGreen);
  uint8_t blue    = map(mapTime, 0, 255, startBlue, endBlue);

  Serial.print(&quot;Time: \t&quot;);
  Serial.print(mapTime);
  Serial.print('\t');
  Serial.print(&quot;Color now: \t&quot;);
  Serial.println(strip.Color(  red,   green,   blue, white),HEX);

  return strip.Color(  red,   green,   blue, white);

}
</code></pre>
<p>The problem im having with this code is visually it would seem that it goes from</p>
<p>Yellow -&gt; White -&gt; violet</p>
<p>and it does not look like a proper transition. I have tried with other colors, and it always seems to pass throught the white color</p>
<p>Are there color theories i can apply for the transition? if you can show me an example sketches on how to do the transition that would also be great.</p>
 42015: <blockquote>
<p>something that will go through the color wheel until the destination color</p>
</blockquote>
<p>For that the <code>FastLED</code> library has the function <code>ColorHSV()</code>, which can be used to define colors using the HSV color space. It stands for <strong>H</strong>ue, <strong>S</strong>aturation and <strong>V</strong>alue (or brightness). Hue is the value representing the position in the color wheel, so that is what you want to change.</p>
<p>Instead of</p>
<pre><code>strip.Color(  red,   green,   blue, white);
</code></pre>
<p>use</p>
<pre><code>strip.ColorHSV( hue, saturation, brightness );
</code></pre>
<p>and change <code>hue</code> over time with the algorithm, that you already programmed. When <code>saturation</code> and <code>brightness</code> stay the same the LEDs will cycle through the color wheel.</p>
<p>Note: The library provides the way from HSV to RGB color (with the above function), but it does not provide a way back. For getting back HSV from an RGB color you would need to write your own conversion function and I don't know how to do that. Though at the current state you don't need it.</p>
