Hi community! I want to build a Philips Hue-ish Strip clone with mysensors or

Hi community!

I want to build a Philips Hue-ish Strip clone with mysensors or esp8266/mqtt. To drive my 5m RGB (non-smart) with FastLED I bought a driver board with 3 FETs and a P9813. I am able to show desired colors. To smoothly blend between the colors, I ended up using nblend. The third parameter is the percentage of blending as far as I understood. It is type hinted as fract8 which is a uint8_t, right? So, I expect to linear blend from color a to b while incrementing the third parameter from 0 to 255. What I observed is, that the blending is already done by i<50, resulting in counting to 255 without further effect. Can somebody explain this to me?

void fadeTo(CRGB color){
for (uint8_t amount = 0; amount < 255; amount++) {
nblend(leds[0], color, amount);
FastLED.delay(10);
}
return;
}

void loop() {
fadeTo(CRGB(random(255),random(255),random(255)));
FastLED.delay(500);
}

Apparently, I don’t know what nblend is exactly doing. I changed it to blend with an extra variable and it worked as expected with a slow blend:

#include <FastLED.h>

#define NUM_LEDS 1
#define DATA_PIN 11
#define CLOCK_PIN 13

int brighness = 255;
CRGB leds[NUM_LEDS];
CRGB lastColor;

void setup() {
FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
FastLED.setCorrection( TypicalLEDStrip );
FastLED.setBrightness( brighness );
}

void fadeTo(CRGB color){
for (uint8_t amount = 0; amount < 255; amount++) {
leds[0] = blend(lastColor, color, amount);
FastLED.delay(20);
}
lastColor = color;
return;
}

void loop() {
fadeTo(CRGB(random(255),random(255),random(255)));
FastLED.delay(500);
}

Thanks, Tim, for that last hunk of code… Hope to have time to play with it this weekend.