# Toggle segments with button

**URL:** <https://wled.discourse.group/t/toggle-segments-with-button/4499>\
**Category:** Questions\
**Created:** [December 26, 2021, 2:57am UTC](https://wled.discourse.group/t/toggle-segments-with-button/4499 "2021-12-26T02:57:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![enselerizer](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/enselerizer/32/2526_2.png) [@enselerizer](https://wled.discourse.group/u/enselerizer)\
**Post date:** [December 26, 2021, 2:57am UTC](https://wled.discourse.group/t/toggle-segments-with-button/4499/1 "2021-12-26T02:57:36Z")

</div>

Hi. I am trying to implement a fairly simple LED strip scenario that suddenly appears to be too complex for WLED, so I am looking for advice on how to implement it.

I have an addressable RGBW type LED strip and two buttons connected to a controller. I want to independently turn on and off one of the two segments of the LED strip by pressing the corresponding button. Also, a long press on either button should turn off both segments at once. The problem I ran into is that a short press on the button should trigger different macros depending on the current state of the segment, which is apparently not possible in WLED.

In addition, each button has a backlight (an LED connected to the controller on a GPIO pin), with which I would like to indicate the state of the corresponding segment of the LED strip (25% PWM for “off” and 100% PWM for “on”). This is not as important as the main functionality, but it is desirable.

Are there any ways to implement this scenario in WLED, or should I consider writing my own firmware?

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [December 26, 2021, 9:38am UTC](https://wled.discourse.group/t/toggle-segments-with-button/4499/2 "2021-12-26T09:38:56Z")

</div>

You can write a usermod (for illuminating button LEDs).  
Segment toggle is possible using `{"seg":[{"id":X,"on":"t"},...]}` JSON API, where X is your segment number.

---

<div class="post-metadata">

**Author:** ![enselerizer](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/enselerizer/32/2526_2.png) [@enselerizer](https://wled.discourse.group/u/enselerizer)\
**Post date:** [December 27, 2021, 8:53pm UTC](https://wled.discourse.group/t/toggle-segments-with-button/4499/3 "2021-12-27T20:53:44Z")

</div>

It looks like a compromise, but thanks, it helped. Now there is one more question: can I display the palette on a segment as a static gradient? I mean, no animation. Reducing the animation speed to zero for some reason doesn’t stop it completely.

---

<div class="post-metadata">

**Author:** ![enselerizer](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/enselerizer/32/2526_2.png) [@enselerizer](https://wled.discourse.group/u/enselerizer)\
**Post date:** [December 27, 2021, 9:06pm UTC](https://wled.discourse.group/t/toggle-segments-with-button/4499/4 "2021-12-27T21:06:21Z")

</div>

Nevermind, found “static” effects, works fine.
