# How can I make a led blink on the dashboard?

**URL:** <https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881>\
**Category:** Dashboard\
**Created:** [1 July 2021 08:14 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881 "2021-07-01T08:14:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidfigueroa](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@davidfigueroa](https://discourse.nodered.org/u/davidfigueroa)\
**Post date:** [1 July 2021 08:14 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/1 "2021-07-01T08:14:27Z")

</div>

How can I make a led blink with more intensity as it is done at a value, for example from 75 to 105, the closer to 105 it blinks faster until it is lit

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 July 2021 08:53 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/2 "2021-07-01T08:53:03Z")

</div>

Is it a real led or a dashboard led?

How far have you got? Are you able to control the led? Are you able to make it blink?

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 09:46 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/3 "2021-07-01T09:46:55Z")

</div>

> [@Colin](#):
>
> or a dashboard led?

The dashboard has virtual LED's? How did I miss that (and still don't see them)? Making an LED matrix with random changing colours is usually one of my first projects on a new platform.

EDIT - Found **node-red-contrib-ui-led**

---

<div class="post-metadata">

**Author:** ![davidfigueroa](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@davidfigueroa](https://discourse.nodered.org/u/davidfigueroa)\
**Post date:** [1 July 2021 11:19 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/4 "2021-07-01T11:19:27Z")

</div>

I know how to control the led but I don't know how to make it blink

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [1 July 2021 11:23 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/5 "2021-07-01T11:23:40Z")

</div>

Here's one example of blinking led. Explore it to gain your ideas.

```auto
[{"id":"c3654bf0.dd1d48","type":"ui_template","z":"407e1abc.6d1cb4","group":"65dfd687.bc39a8","name":"","order":0,"width":"1","height":"1","format":"<style>\n.led {\n position:absolute;\n left: 0;\n right:0;\n top:0;\n bottom:0;\n width: 15px;\n height: 15px;\n margin: auto;\n border-radius: 50%;\n}\n</style>\n\n<div><span class=\"led\" style=\"background-color: {{msg.payload}}; box-shadow: #000000BB 0 -1px 1px 0px, inset #000000AA 0 -1px 4px, {{msg.payload}} 0 3px 15px;\"></span></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":660,"y":960,"wires":[["d6e65627.4ad0c8"]]},{"id":"d4148083.07318","type":"trigger","z":"407e1abc.6d1cb4","name":"blink blue","op1":"colors.led.blue","op2":"colors.led.off","op1type":"global","op2type":"global","duration":"250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":460,"y":960,"wires":[["c3654bf0.dd1d48"]]},{"id":"48c6152a.00e40c","type":"change","z":"407e1abc.6d1cb4","name":"","rules":[{"t":"set","p":"colors.led","pt":"global","to":"{\"off\":\"#696969\",\"red\":\"red\",\"green\":\"#7aeb7a\",\"blue\":\"#0000ff\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":920,"wires":[[]]},{"id":"35b42b91.fe36a4","type":"inject","z":"407e1abc.6d1cb4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":920,"wires":[["48c6152a.00e40c"]]},{"id":"fa4166a9.ef47a8","type":"trigger","z":"407e1abc.6d1cb4","name":"blink red","op1":"colors.led.red","op2":"colors.led.off","op1type":"global","op2type":"global","duration":"250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":460,"y":1020,"wires":[["c3654bf0.dd1d48"]]},{"id":"b8ffaaf5.c51ca8","type":"delay","z":"407e1abc.6d1cb4","name":"","pauseType":"random","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"200","randomLast":"500","randomUnits":"milliseconds","drop":false,"x":320,"y":1020,"wires":[["fa4166a9.ef47a8"]]},{"id":"d6e65627.4ad0c8","type":"switch","z":"407e1abc.6d1cb4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"colors.led.blue","vt":"global"}],"checkall":"true","repair":false,"outputs":1,"x":810,"y":960,"wires":[["b8ffaaf5.c51ca8"]]},{"id":"3f1b249.42e3fdc","type":"ui_button","z":"407e1abc.6d1cb4","name":"","group":"65dfd687.bc39a8","order":15,"width":0,"height":0,"passthru":false,"label":"Lit led","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":210,"y":960,"wires":[["d4148083.07318"]]},{"id":"65dfd687.bc39a8","type":"ui_group","name":"Default","tab":"5394d338.3dd19c","order":1,"disp":true,"width":"6","collapse":false},{"id":"5394d338.3dd19c","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 18:52 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/6 "2021-07-01T18:52:41Z")

</div>

Another simple flasher with only three nodes. You just come up with a variable injection. I'm working on a few options myself.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e97ccf5496a03d5b039bff117b453b18ddcaa84.png)

```auto
[{"id":"af1708dc.4e6ce8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"1cd530d8.0510bf","type":"ui_led","z":"af1708dc.4e6ce8","order":2,"group":"65dfd687.bc39a8","width":"2","height":"2","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#0000ff","value":"1","valueType":"num"},{"color":"#000000","value":"0","valueType":"num"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":490,"y":80,"wires":[]},{"id":"efde91d9.e81c1","type":"toggle","z":"af1708dc.4e6ce8","name":"","onOffTopic":"","onValue":"1","onType":"num","offValue":"0","offType":"num","toggleTopic":"","toggleValue":"togglenow","toggleType":"str","passOnOff":"always","x":330,"y":80,"wires":[["1cd530d8.0510bf"]]},{"id":"fb9d6499.8dc708","type":"inject","z":"af1708dc.4e6ce8","name":"","props":[{"p":"payload"}],"repeat":".5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"togglenow","payloadType":"str","x":160,"y":80,"wires":[["efde91d9.e81c1"]]},{"id":"65dfd687.bc39a8","type":"ui_group","name":"Default","tab":"5394d338.3dd19c","order":1,"disp":true,"width":"6","collapse":false},{"id":"5394d338.3dd19c","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [2 July 2021 09:22 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/7 "2021-07-02T09:22:12Z")

</div>

> [@davidfigueroa](#):
>
> the closer to 105 it blinks faster until it is lit

After much fuss and hair pulling at my end... and a quick fix by @Steve-Mcl Here is an example that you should be able to adapt.

Exchange the slider's function (just sending a number representing milliseconds) with that of some code that sets increasing frequency ranges based on some other value as needed.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/73897c9eecb5b74e1e101904a6e8ea9ef317c38c.png)

```auto
[{"id":"af1708dc.4e6ce8","type":"tab","label":"Flasher","disabled":false,"info":""},{"id":"1cd530d8.0510bf","type":"ui_led","z":"af1708dc.4e6ce8","order":2,"group":"85815d64.6c718","width":"2","height":"2","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#0000ff","value":"true","valueType":"bool"},{"color":"#000000","value":"false","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":570,"y":320,"wires":[]},{"id":"efde91d9.e81c1","type":"toggle","z":"af1708dc.4e6ce8","name":"","onOffTopic":"","onValue":"true","onType":"bool","offValue":"false","offType":"bool","toggleTopic":"","toggleValue":"togglenow","toggleType":"str","passOnOff":"ifChanged","x":570,"y":260,"wires":[["1cd530d8.0510bf"]]},{"id":"95c7325.18127d","type":"ui_slider","z":"af1708dc.4e6ce8","name":"Frequency","label":"slider","tooltip":"","group":"85815d64.6c718","order":0,"width":0,"height":0,"passthru":false,"outs":"end","topic":"delay","topicType":"msg","min":"32","max":"2000","step":1,"x":150,"y":320,"wires":[["97729620.9d6d08"]]},{"id":"c6b10cae.c126a","type":"trigger","z":"af1708dc.4e6ce8","name":"Trigger","op1":"togglenow","op2":"false","op1type":"str","op2type":"bool","duration":"-250","extend":false,"overrideDelay":true,"units":"ms","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":360,"y":260,"wires":[["efde91d9.e81c1"]]},{"id":"bafe11a7.88056","type":"ui_button","z":"af1708dc.4e6ce8","name":"","group":"85815d64.6c718","order":2,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"reset","payloadType":"str","topic":"reset","topicType":"msg","x":150,"y":280,"wires":[["c6b10cae.c126a"]]},{"id":"97729620.9d6d08","type":"change","z":"af1708dc.4e6ce8","name":"Magic beans ;)","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":320,"wires":[["c6b10cae.c126a"]]},{"id":"85815d64.6c718","type":"ui_group","name":"","tab":"bb7236c.d277cc8","order":2,"disp":true,"width":"6","collapse":false},{"id":"bb7236c.d277cc8","type":"ui_tab","name":"Flashing LED","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 July 2021 11:48 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/8 "2021-07-02T11:48:48Z")

</div>

I don't want to stick my nose into too many threads....

There is another switch node (as in on/off) but it is a multi position one which slides left/right.

Sorry, I can't remember the name and so may shouldn't post here. But just to suggest a _nicer_ way of doing what you want.

Rather than the `reset` button and the `toggle` you would/could just use that node and have 3 positions.

I though I installed it but when I went to look, I can't find it.  
Sorry.

## Found it!

[Multistate switch](https://flows.nodered.org/node/node-red-contrib-ui-multistate-switch)

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [2 July 2021 20:58 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/9 "2021-07-02T20:58:55Z")

</div>

> [@Trying\_to\_learn](#):
>
> Found it!

Thanks... always nice to have more buttons to poke and switches to flip 😛 And it could work nicely for preset frequency (and reset/off 😉 ) settings.

The toggle node in my flow is not a dashboard toggle switch, it is a logical "toggle switch" that does the state change work for the actual flashing.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 July 2021 22:16 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/10 "2021-07-02T22:16:20Z")

</div>

> [@Gunner](#):
>
> The toggle node in my flow is not a dashboard toggle switch, it is a logical "toggle switch" that does the state change work for the actual flashing.

Oh. OK.

~~Um, (sorry) but the `trigger` node should be able to be set to control the flashing of the `ui-led` node.~~

Oh. Ok. Looking at the flow now.

I may (just to help kill some time) see if I can get it a bit better.  
(But your `toggle` node isn't there when I import the flow)

Ok, no, sorry. You are right. I only just got up. Brain not working.

---

<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:** [1 August 2021 22:16 UTC](https://discourse.nodered.org/t/how-can-i-make-a-led-blink-on-the-dashboard/47881/11 "2021-08-01T22:16:53Z")

</div>

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