Antialiasing / Subpixel rendering on WS2812

Hi,
I have some WS2812 strip hooked up to my Arduino Pro Micro. I use the FastLED library and I wrote a function to display a rainbow and a second function to add moving white segments ontop of that. I noticed that the movement of these segment is really choppy, when the movement is slow. So the first and the last LED of the white segment should slowly fade in, instead of just tuning on. My Idea is to add a form of antialiasing or subpixel rendering, but I have no clue how. I tried to finde something similar on Google, but I didn’t find anything that seemed suitable for this application.
I hope someone can help me.

csprvb

My current code

#include <FastLED.h>


#define NUM_LEDS 12      /* The amount of pixels/leds you have */
#define DATA_PIN 2       /* 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 100   /* Control the brightness of your leds */
#define SATURATION 255   /* Control the saturation of your leds */

int num = 2;
int segmentLength = 3;
int l = 0;

int color1[] = {255,0,0};
CRGB leds[NUM_LEDS];

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

void loop() {
  rainbow();
}

void rainbow(){
  for (int j = 0; j < 255; j++) {
    for (int i = 0; i < NUM_LEDS; i++) {
      leds[i] = CHSV(i - (j * 2), SATURATION, BRIGHTNESS);   
    }
    addStripes();
    FastLED.show();
    delay(60); 
  }
  
}

void addStripes(){
  for (int i = 0; i < NUM_LEDS; i++) {
      if((i % (NUM_LEDS / num )) == 0) {
          for (int k = 0; k < segmentLength; k++){
            if( k == 0 || k == segmentLength-1){ 
              leds[(i+k+l) % NUM_LEDS] = CHSV(0,0,BRIGHTNESS/2);
            } else{
              leds[(i+k+l) % NUM_LEDS] = CHSV(0,0,BRIGHTNESS);
            }
          }
      }
  }
  l+=1;
  l %= NUM_LEDS / num;
}

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