Neopixel flickering issues

Hi there. I'm very new to programming and using the Arduino so forgive me if this is a stupid mistake.
I set up an Arduino nano and some Neopixel sticks (3 x 8led sticks) in my PC case and pulled the pwm output from a motherboard header to control the color in relation to cpu temp. I used a low pass filter to convert pwm back into an analog signal. It works flawlessly if I just set it to change one parameter, for example just Hue. but I'm trying to get it to fade from white to purple to red. The code I have attached works but it flickers to white as it transitions from red to purple. It seems to be fairly sporadic so I'm kind of stumped here. Thanks for any help folks!

#include <FastLED.h>

#define LED_TYPE WS2812
#define COLOR_ORDER GRB 
#define NUM_LEDS 24
#define DATA_PIN 3
#define BRIGHTNESS 255

const int cha1 = A7;

CRGB leds[NUM_LEDS];

void setup() {
  Serial.begin (9600);
  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  FastLED.setBrightness (BRIGHTNESS);
}

void loop() {
  int cha1 = analogRead(A7);

  Serial.println (cha1);
  
  int analMap = map( analogRead (cha1), 0, 1023, 155, 255);
  int satVal = ( analogRead (cha1));

  satVal = constrain ( satVal, 0, 255 );
  
  fill_solid ( & (leds [0]), 24, CHSV ( analMap, satVal, 255));
  FastLED.show ();
  FastLED.delay (1);
  
}

Please go back and edit your post. Post the code inside code tags instead of attaching it, per the forum rules.

And please produce adecvate docummentation, wirings etc., not Shakespeare type descriptions.

here's a wiring diagram. I'm 95% sure that's how it's wired up. If there's anything glaringly wrong I can pull it all apart and double check it.

Your neopixel strip has 2 pins going to GND?

Where is the V+ line going to? (looks like it terminates at the cap?.. making the cap line in-line? hmmmm)

What is the CIRCLE? part (another cap?) why?

everything is grounded to a rail, and the circle is a 5v molex power supply.

Just in case it wasn't clear in the original post, it works really well until I try to add in a the saturation variable. also if I just map the saturation (0, 1023, 0, 255) that works as well. it's when I try to use constrain to get the saturation to go to 255 and stop 1/4 of the way through the analogread that it gets funky.

I actually figured it out, it didn't like the extra " int cha1 = analogRead(A7); " line in the loop for some reason. it was leftover from something else I was trying and I forgot to remove it from the code :cry: thanks for trying to help me though!

circuit.png

What is "FastLED.delay (1);" supposed to do?

I took that out too, I was hoping some delay would help smooth it out. The code I got working ended up looking like this.

#include <FastLED.h>

#define LED_TYPE WS2812
#define COLOR_ORDER GRB 
#define NUM_LEDS 24
#define DATA_PIN 3
#define BRIGHTNESS 255

const int cha1 = A7;

CRGB leds[NUM_LEDS];

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

void loop() {
  
  int analMap = map( analogRead (cha1), 0, 1023, 160, 255);
  int satVal = ( analogRead (cha1));

  satVal = constrain ( satVal, 0, 255 );
  
  fill_solid ( & (leds [0]), 24, CHSV ( analMap, satVal, 255));
  FastLED.show ();
  
}