# Static White Pattern

**URL:** <https://forum.electromage.com/t/static-white-pattern/1155>\
**Category:** Patterns and Code\
**Created:** [April 9, 2021, 1:54am UTC](https://forum.electromage.com/t/static-white-pattern/1155 "2021-04-09T01:54:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkatz](https://forum.electromage.com/letter_avatar_proxy/v4/letter/j/c68b51/32.png) [@jkatz](https://forum.electromage.com/u/jkatz)\
**Post date:** [April 9, 2021, 1:54am UTC](https://forum.electromage.com/t/static-white-pattern/1155/1 "2021-04-09T01:54:57Z")

</div>

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!

Thanks,  
Jon

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [April 9, 2021, 2:11am UTC](https://forum.electromage.com/t/static-white-pattern/1155/2 "2021-04-09T02:11:16Z")

</div>

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

This should get it done for you.

```javascript
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 😑 Now it’s fixed in the above, with [Wizard’s mod polyfill](https://forum.electromage.com/t/task-8-serpentine-square/1088/12) for v2 users.

---

<div class="post-metadata">

**Author:** ![jkatz](https://forum.electromage.com/letter_avatar_proxy/v4/letter/j/c68b51/32.png) [@jkatz](https://forum.electromage.com/u/jkatz)\
**Post date:** [April 9, 2021, 2:39am UTC](https://forum.electromage.com/t/static-white-pattern/1155/3 "2021-04-09T02:39:25Z")

</div>

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)  
}

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.electromage.com/user_avatar/forum.electromage.com/jeff/32/3473_2.png) [@jeff](https://forum.electromage.com/u/jeff)\
**Post date:** [April 9, 2021, 4:08pm UTC](https://forum.electromage.com/t/static-white-pattern/1155/4 "2021-04-09T16:08:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jkatz](https://forum.electromage.com/letter_avatar_proxy/v4/letter/j/c68b51/32.png) [@jkatz](https://forum.electromage.com/u/jkatz)\
**Post date:** [April 9, 2021, 8:07pm UTC](https://forum.electromage.com/t/static-white-pattern/1155/5 "2021-04-09T20:07:51Z")

</div>

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!

Regards,  
Jon
