# Setting push button

**URL:** <https://wled.discourse.group/t/setting-push-button/5338>\
**Category:** Questions\
**Created:** [May 9, 2022, 11:42am UTC](https://wled.discourse.group/t/setting-push-button/5338 "2022-05-09T11:42:31Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 11:42am UTC](https://wled.discourse.group/t/setting-push-button/5338/1 "2022-05-09T11:42:31Z")

</div>

Hello guys. I want to use a push button to turn wled on and off. I make it work. I create 2 presets; 1 preset T=1 and another preset T=0 but I can just have one short press to make one funtion and a long press to do the other. How can I make that with a single press turn it on and off? The 2 api commands in the same preset? Thanks a bunch in advance… 😊

---

<div class="post-metadata">

**Author:** ![divsys](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@divsys](https://wled.discourse.group/u/divsys)\
**Post date:** [May 9, 2022, 1:41pm UTC](https://wled.discourse.group/t/setting-push-button/5338/2 "2022-05-09T13:41:53Z")

</div>

There is a “toggle on-off” function in the API that covers this.  
Take a look at: [Push button for each segment - #4 by blazoncek](https://wled.discourse.group/t/push-button-for-each-segment/5289/4)  
Also the API section of the docs: [JSON API - WLED Project](https://kno.wled.ge/interfaces/json-api/)

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 3:13pm UTC](https://wled.discourse.group/t/setting-push-button/5338/3 "2022-05-09T15:13:21Z")

</div>

I read those already but I am not that clear to understand it. And I am using push button…

---

<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:** [May 9, 2022, 3:45pm UTC](https://wled.discourse.group/t/setting-push-button/5338/4 "2022-05-09T15:45:58Z")

</div>

Button 0 does that by default.

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 4:25pm UTC](https://wled.discourse.group/t/setting-push-button/5338/5 "2022-05-09T16:25:46Z")

</div>

You mean the on board button? When I press that one it full reset the esp32 erasing all the settings. If I change the button 1 by 0 how I set both presets to respond to a single press?

---

<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:** [May 9, 2022, 4:27pm UTC](https://wled.discourse.group/t/setting-push-button/5338/6 "2022-05-09T16:27:10Z")

</div>

That’s not right. I’m guessing you had a bad flash. What is the size of the file system in Info?

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 4:31pm UTC](https://wled.discourse.group/t/setting-push-button/5338/7 "2022-05-09T16:31:54Z")

</div>

![Screenshot_20220509-122921](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/6/611b4c6d1971780e4371f5ab4dcd3255bbfaf22c.png)  
 ![Screenshot_20220509-122929](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/8/8f008fefa66ea4a1cff5f617e45a3de34d405357.png)  
I have some presets already saved  
 ![Screenshot_20220509-123103](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/5/5627b1b29663dd81c77f7e997da465e5957a9c22.png)  
 ![Screenshot_20220509-123121](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/c/cacef9f720f1a6380124b2d7029ece4cc3396935.png)

---

<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:** [May 9, 2022, 4:42pm UTC](https://wled.discourse.group/t/setting-push-button/5338/8 "2022-05-09T16:42:25Z")

</div>

Yep, bad flash. Your file system should have more than 61k. 😉

Use the web installer.

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 4:57pm UTC](https://wled.discourse.group/t/setting-push-button/5338/9 "2022-05-09T16:57:54Z")

</div>

😭😭😭 and the worst part is that the wled is a acting good now. It wont erase the Led settings like was doing it before… How many kb must have?

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 5:08pm UTC](https://wled.discourse.group/t/setting-push-button/5338/10 "2022-05-09T17:08:31Z")

</div>

What about now?

 ![Screenshot_20220509-130742](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/4/403213628082a773b6d982ef0c3eb4e0fe11219b.png)

---

<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:** [May 9, 2022, 6:52pm UTC](https://wled.discourse.group/t/setting-push-button/5338/11 "2022-05-09T18:52:15Z")

</div>

That’s better!

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 7:04pm UTC](https://wled.discourse.group/t/setting-push-button/5338/12 "2022-05-09T19:04:36Z")

</div>

Great… Now how I set it to make it ON and OFF with a single pulse the same button in the same input? 😊

---

<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:** [May 9, 2022, 7:06pm UTC](https://wled.discourse.group/t/setting-push-button/5338/13 "2022-05-09T19:06:15Z")

</div>

As mentioned, that is the default for the built-in button.

---

<div class="post-metadata">

**Author:** ![Changchung](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/changchung/32/3115_2.png) [@Changchung](https://wled.discourse.group/u/Changchung)\
**Post date:** [May 9, 2022, 7:33pm UTC](https://wled.discourse.group/t/setting-push-button/5338/14 "2022-05-09T19:33:13Z")

</div>

Ok. I am not at home yet. So. I can just change the gpi23 where I have it now for gpi0 in button 0? No changes in macros? I still need the on and off presets? 😊
