# Node red Javascript with start en stop payload for led blink

**URL:** <https://discourse.nodered.org/t/node-red-javascript-with-start-en-stop-payload-for-led-blink/64780>\
**Category:** General\
**Tags:** function-node\
**Created:** [6 July 2022 20:36 UTC](https://discourse.nodered.org/t/node-red-javascript-with-start-en-stop-payload-for-led-blink/64780 "2022-07-06T20:36:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirelam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kirelam/32/64294_2.png) [@kirelam](https://discourse.nodered.org/u/kirelam)\
**Post date:** [6 July 2022 20:36 UTC](https://discourse.nodered.org/t/node-red-javascript-with-start-en-stop-payload-for-led-blink/64780/1 "2022-07-06T20:36:31Z")

</div>

Dear Nodes,

I am no scripter, so i do not now "yet" how to program Javascript to do the following:

- Node red Javascript node with a start (1) and stop (0) payload for led blink. And then something with a tme like 500ms.

I am trying to make a real led blink through MQTT to a ESP32 with ESPeasy on it.

I am trying to learn it, but I find it very hard, as I have no background in this.  
I have found serveral scripts, but I cannot get them to do what i want.

Can anyone help me and script this for me?

Kind regards,  
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:** [6 July 2022 20:46 UTC](https://discourse.nodered.org/t/node-red-javascript-with-start-en-stop-payload-for-led-blink/64780/2 "2022-07-06T20:46:05Z")

</div>

You do not have to use Javascript, Node-red is a low code application. You could do this with standard nodes.  
e.g.

```auto
[{"id":"68ea8547.c02aa4","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":60,"wires":[["7106b69a.b98268"]]},{"id":"7106b69a.b98268","type":"change","z":"bf9e1e33.030598","name":"set blinks","rules":[{"t":"set","p":"payload","pt":"msg","to":"[1,0,1,0]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"topic/path/to/light","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":60,"wires":[["26637ee8.d53c0a"]]},{"id":"26637ee8.d53c0a","type":"split","z":"bf9e1e33.030598","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":490,"y":60,"wires":[["138c48.92de2bb8"]]},{"id":"138c48.92de2bb8","type":"delay","z":"bf9e1e33.030598","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":650,"y":60,"wires":[["670e4932.d1efe8"]]},{"id":"670e4932.d1efe8","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":740,"y":140,"wires":[]}]

```

---

<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:** [4 September 2022 20:46 UTC](https://discourse.nodered.org/t/node-red-javascript-with-start-en-stop-payload-for-led-blink/64780/3 "2022-09-04T20:46:11Z")

</div>

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