# Joystick/automatic returning slider

**URL:** <https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880>\
**Category:** Dashboard\
**Created:** [27 October 2020 09:37 UTC](https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880 "2020-10-27T09:37:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![meesm](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@meesm](https://discourse.nodered.org/u/meesm)\
**Post date:** [27 October 2020 09:37 UTC](https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880/1 "2020-10-27T09:37:12Z")

</div>

Hello everyone!  
My name is Mees and I'm starting out with NodeRED.  
For a small project I would like to controll a small RC car from the NodeRED dashboard.  
I would like to either make these based on template nodes or (if needed) a custom node.

The idea is to controll forward/backwards motion with 1 joystick/slider and left/right motion with the other. The output should be continuous while touching the joystick/slider, but return to 0 on release. Basically like the regular RC remote controllers.

I tried using the standard sliders in NodeRED dashboard, but they wont allow me to both get continuous output and release detection.

Thanks in advance!!  
Kind regards, Mees

---

<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:** [27 October 2020 13:38 UTC](https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880/2 "2020-10-27T13:38:17Z")

</div>

There is these node that will trigger on keyboard and mouse events, not sure on touch screen.

> **[node-red-contrib-io-hook](https://flows.nodered.org/node/node-red-contrib-io-hook)**
>
> Node for capturing keystrokes and mousestrokes

  

> **[node-red-contrib-keyboard-mouse-triggers](https://flows.nodered.org/node/node-red-contrib-keyboard-mouse-triggers)**
>
> Nodered node, triggers on global keyboard or mouse events.

  
You could possible use one to send payload 0 to input of slider when mouse/touch event released.

Edit/  
You can get similar functionality to what you wish, with a trigger node and a change node. e.g.

```auto
[{"id":"87390807.c078b8","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"(payload = 0 ? payload : (payload < 0 ? payload + 1 : payload - 1))","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":2580,"wires":[["3f251666.510f9a"]]},{"id":"78e9d10a.dfb168","type":"trigger","z":"8d22ae29.7df6d","name":"","op1":"","op2":"","op1type":"pay","op2type":"payl","duration":"250","extend":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":550,"y":2640,"wires":[["a8916d48.6b4c78"],["87390807.c078b8"]]},{"id":"3f251666.510f9a","type":"ui_slider","z":"8d22ae29.7df6d","name":"","label":"slider","tooltip":"","group":"165e1e1a.e752fa","order":4,"width":"6","height":"1","passthru":true,"outs":"all","topic":"letf/right","min":"-5","max":"5","step":1,"x":360,"y":2640,"wires":[["78e9d10a.dfb168"]]},{"id":"a8916d48.6b4c78","type":"debug","z":"8d22ae29.7df6d","name":"Na Template","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":2520,"wires":[]},{"id":"8e65f74c.65599","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":2680,"wires":[["3f251666.510f9a","ad38de4.f4a09a"]]},{"id":"7f5ed4af.79605c","type":"trigger","z":"8d22ae29.7df6d","name":"","op1":"","op2":"","op1type":"pay","op2type":"payl","duration":"250","extend":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":550,"y":2720,"wires":[["a8916d48.6b4c78"],["7fc6bea7.c13d78"]]},{"id":"ad38de4.f4a09a","type":"ui_slider","z":"8d22ae29.7df6d","name":"","label":"slider","tooltip":"","group":"165e1e1a.e752fa","order":5,"width":"1","height":"6","passthru":true,"outs":"end","topic":"forward/back","min":"-5","max":"5","step":1,"x":360,"y":2720,"wires":[["7f5ed4af.79605c"]]},{"id":"7fc6bea7.c13d78","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"(payload = 0 ? payload : (payload < 0 ? payload + 1 : payload - 1))","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":2780,"wires":[["ad38de4.f4a09a"]]},{"id":"165e1e1a.e752fa","type":"ui_group","z":"","name":"Default","tab":"f9b58883.fa613","order":1,"disp":true,"width":"12","collapse":false},{"id":"f9b58883.fa613","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

You just have to keep tapping.

---

<div class="post-metadata">

**Author:** ![meesm](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@meesm](https://discourse.nodered.org/u/meesm)\
**Post date:** [28 October 2020 06:44 UTC](https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880/3 "2020-10-28T06:44:22Z")

</div>

Thank you so much! This is really close to what I would like!  
I think I should be able to adjust it according to my wishes.

---

<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:** [27 November 2020 06:44 UTC](https://discourse.nodered.org/t/joystick-automatic-returning-slider/34880/4 "2020-11-27T06:44:25Z")

</div>

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