Static White Pattern

Hi All,

Total newb here… I just swapped in my new V3 for my V2 that stopped responding. I had a pattern I cant seem to recreate. It was 5 LEDs on in white every 20 across my strip of 450. No motion just static white.

Any help would be appreciated!


No prob. I’m assuming you’re not looking to be taught how to fish here.

This should get it done for you.

var offset = 0 // How far to start from the left
var onCount = 5
var every = 20

export function render(index) {
  on = mod(index - offset, every) < onCount
  hsv(0, 0, on)

// You only need this on PB v2
function mod(dividend, divisor) {
  var res = dividend % divisor
  if ((res != 0) && (res > 0) != (divisor > 0)) { //this compares the sign of both
    res += divisor
  return res

Edit: The guy who asked for a builtin mod() (me) forgot to use it correctly :expressionless: Now it’s fixed in the above, with Wizard’s mod polyfill for v2 users.


Thank Jeff, this community and product is awesome! This makes perfect sense. i edited the below and got close, but not really sure why it worked and i know its not correct. your example i actually understand, thank you!

Color fade pulse

Pulses travel slowly to the left, while colors travel quickly to the right.
Pulses change how colorful they are slowly, close to the pulse moving speed.

export function beforeRender(delta) {
t1 = time(0) // For hue movement
t2 = time(0) // For pulse movement
t3 = time(0) // White / desaturation movement

export function render(index) {
// When you see a function using time as a - t1 phase shift, this is moving
// to the right.
h = index / pixelCount * 2 - t1

This creates the pulses themselves. A + t2 indicates these will be moving
to the left. The * 4 makes them more frequent in the strip. In fact, you
an think of this as “having 4 pulses visible at any given time.”
v = triangle(index / pixelCount * 25 + t2)
v = v * v * v * v

// Every few pulses will be whiter (low saturation). Each pulse will very
// slowly alternate between a whitish pulse and deeper saturated hues.
s = wave(index / pixelCount / 2 + t3)

hsv(h, 0, v)

1 Like

Absolutely love that you gave it a shot. I’d rather mentor than just provide code, but it’s nice to just get a project done sometimes and be able to learn more later.

1 Like

Hi Jeff, i always like to learn! I just didnt have a starting point for static patterns. this is fantastic and i can certainly run with this and begin my journey!

Thank you again for the quick help!