I'm new to the whole programming game but i took on a pretty ambitious

I’m new to the whole programming game but i took on a pretty ambitious (for my skill set) project that needs to be completed before Christmas. I’ve come here to see if anyone can steer me in the right direction. What I’m trying to do is have the brightness of a 40 pixel strip of neopixels controlled by a quadratic function that could be moved down the strip. I’m wondering if anyone could link me to some code that would start me off. Sorry if this is very basic.

  • latest FastLED library 3.0
  • Arduino Uno
  • Mac

Let me see if I understand basically:

You want the brightness of each pixel to be based on f(x), where x is the pixel number (plus some every-increasing offset so that it scrolls? Something like that?

If so, that’s pretty quick. I’ll post a sample a bit later if no one else chimes in!

This should give you an idea of how that might work.

void sinwave() {
// slide everything down one
memmove8(&leds[1],&leds[0],(NUM_LEDS-1)*sizeof( CRGB ));
// update the first led.
leds[0] = CHSV(255,255,beatsin8(150,50,240);
}

Depending on how expansive the f(x) function is, you could also repaint the whole strip with data each time.

(Nice “one-liner” there!)

@Mark_Kriegsman Yup that’s exactly what i need. And then depending on the time given by an RTC the f(x) will loop down the strip. I’m trying to model daylight around the world. Thanks for the advice!