# Make Effects only when button is pressed

**URL:** <https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131>\
**Category:** Enhancements\
**Created:** [February 18, 2020, 8:48am UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131 "2020-02-18T08:48:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dariox3084](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dariox3084](https://wled.discourse.group/u/dariox3084)\
**Post date:** [February 18, 2020, 8:48am UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/1 "2020-02-18T08:48:30Z")

</div>

Hello guys, i’ve installed strip led with WLED on my garage door (instead of standard blink light) but i’ve one question: I tried the button (gpio-\>gnd) and it works like a charms, but what i need is that the led does a pre-selected effect ONLY when the button is pressed (not short, not long etc press), because i’d like to link the button directly to garage door opener dry contact for blinking light. Can someone tell me if this is possible with the current version of WLED? i’m looking through macros and other stuff but nothing seems to be what i need…☹

I guess it’s an enhancements…

---

<div class="post-metadata">

**Author:** ![Aircoookie](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aircoookie/32/2_2.png) [@Aircoookie](https://wled.discourse.group/u/Aircoookie)\
**Post date:** [February 18, 2020, 10:30pm UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/2 "2020-02-18T22:30:22Z")

</div>

Hi,  
I believe what you are looking for is a feature to have the button act like a switch - run config A as long as it is pressed and config B when it is not pressed/released. I believe I could add such a feature quite easily soon 🙂

---

<div class="post-metadata">

**Author:** ![dariox3084](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dariox3084](https://wled.discourse.group/u/dariox3084)\
**Post date:** [February 18, 2020, 10:44pm UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/3 "2020-02-18T22:44:34Z")

</div>

Yes exactly 😉 as long as the button is pressed , run some configuration, when the button is not pressed anymore stops the current effect …Btw great works really, i made a donation such work deserve it 😉 Thank you!

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [April 24, 2020, 10:00pm UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/4 "2020-04-24T22:00:05Z")

</div>

It _seems_ like we would need to eliminate the short, long, and double-presses for this, which I think I’m okay with. Replace what is there with only button-down and button-up logic.

---

<div class="post-metadata">

**Author:** ![lanman1](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@lanman1](https://wled.discourse.group/u/lanman1)\
**Post date:** [April 25, 2020, 1:19am UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/5 "2020-04-25T01:19:16Z")

</div>

To me , this implies a ButtonA, and ButtonB, ButtonC…

---

<div class="post-metadata">

**Author:** ![Mark02660](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/mark02660/32/2832_2.png) [@Mark02660](https://wled.discourse.group/u/Mark02660)\
**Post date:** [February 13, 2022, 4:05am UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/6 "2022-02-13T04:05:04Z")

</div>

Was this ever implemented?  
I am also trying to make all the LEDs red when the button is pressed and then go back to whatever it was doing before the button was pressed.

My other thought was to do it with custom code but I was not sure if I would be able to use the same GPIO pin?

All I have been able to do so far is use the button to call a macro but it will not go back when the button is released.

---

<div class="post-metadata">

**Author:** ![tonyno](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/tonyno/32/242_2.png) [@tonyno](https://wled.discourse.group/u/tonyno)\
**Post date:** [February 14, 2022, 4:54pm UTC](https://wled.discourse.group/t/make-effects-only-when-button-is-pressed/131/7 "2022-02-14T16:54:08Z")

</div>

You can do this with two presets using the HTTP API commands to save/load a preset. The first preset (button on) saves the state and switches to a red preset. The second preset (button off) loads the saved state.
