# One button to control On and Off LED

**URL:** <https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [9 May 2024 06:34 UTC](https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821 "2024-05-09T06:34:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fourskin99](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@fourskin99](https://discourse.nodered.org/u/fourskin99)\
**Post date:** [9 May 2024 06:34 UTC](https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821/1 "2024-05-09T06:34:44Z")

</div>

Hi, I want to create a single button that can control on and off LED. When I click for the 1st time, it will turn on the LED and stay on until next I click. Then 2nd time click, it will turn off the LED until next click. Anybody can help me ?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 May 2024 07:12 UTC](https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821/2 "2024-05-09T07:12:59Z")

</div>

This has been ccovered many times on this forum, a quick search for [toggle button](https://discourse.nodered.org/search?q=button%20toggle%20order%3Alatest) should reveal many solutions

From that search result.

> [@How to set up a toggle button?](https://discourse.nodered.org/t/how-to-set-up-a-toggle-button/80132):
>
> How do I go about setting up a toggle button? I realise switches toggle, but they get difficult to tell apart when there are any more than 1 next to each other. I want to make a button that toggles between on/off states and changes colour/text/icon for each state. I have tried the following: [Dashboard toggle without switch by Ranki](https://discourse.nodered.org/t/dashboard-toggle-button-without-switch/45777/4); icon changes on click, but if I so much as change the icons in the flow, the switch breaks and becomes unresponsive [Pushbutton flow](https://flows.nodered.org/flow/7325d06be6c8a415c877a941172dbc86) - very nice, organised flow tha…

---

<div class="post-metadata">

**Author:** ![fourskin99](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@fourskin99](https://discourse.nodered.org/u/fourskin99)\
**Post date:** [9 May 2024 07:28 UTC](https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821/3 "2024-05-09T07:28:54Z")

</div>

Thankyou so much.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 June 2024 07:29 UTC](https://discourse.nodered.org/t/one-button-to-control-on-and-off-led/87821/4 "2024-06-08T07:29:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
