# Problem sending slider value to OSC

**URL:** <https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445>\
**Category:** General\
**Created:** [5 December 2023 18:10 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445 "2023-12-05T18:10:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhoepffner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhoepffner/32/69679_2.png) [@jhoepffner](https://discourse.nodered.org/u/jhoepffner)\
**Post date:** [5 December 2023 18:10 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/1 "2023-12-05T18:10:14Z")

</div>

Hello,  
I have problem sending variable data (moved by a dashboard slider) by OSC.  
If I send  
{"type": "i", "value": 4096}, it work  
if I send  
{"type": "i", "value": "{{payload}}"}, it doen't work.  
I tried all the combination of quote and curls…  
How can I replace the value by the message payload received from the slider?  
Thank you in advance,  
Jacques

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [5 December 2023 18:33 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/2 "2023-12-05T18:33:29Z")

</div>

It would be nice if you explained what OIC is, what nodes you are using, maybe export your flow and paste it to a reply, because you haven’t given enough information.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 December 2023 18:36 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/3 "2023-12-05T18:36:23Z")

</div>

> [@zenofmud](#):
>
> It would be nice if you explained what OIC is

And OSC 😉

---

<div class="post-metadata">

**Author:** ![jhoepffner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhoepffner/32/69679_2.png) [@jhoepffner](https://discourse.nodered.org/u/jhoepffner)\
**Post date:** [5 December 2023 18:44 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/4 "2023-12-05T18:44:35Z")

</div>

Hello,  
Thank you for your answer. OSC is Open Sound Control, a protocol to send data through UDP and there is a node-red node transforming json to OSC.  
Here is the flow

```auto
[
    {
        "id": "f77fbd8e15e87f4e",
        "type": "tab",
        "label": "Dynamixel",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9bbde0876f3a3a70",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/goal",
        "payload": "{\"type\":\"i\",\"value\":4096}",
        "payloadType": "json",
        "x": 240,
        "y": 380,
        "wires": [
            [
                "87757859285292bd",
                "04f98530e5b9af33"
            ]
        ]
    },
    {
        "id": "87757859285292bd",
        "type": "osc",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "path": "",
        "metadata": false,
        "x": 830,
        "y": 460,
        "wires": [
            [
                "ce292a98dc2ecaa2"
            ]
        ]
    },
    {
        "id": "ce292a98dc2ecaa2",
        "type": "udp out",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "addr": "localhost",
        "iface": "",
        "port": "7001",
        "ipv": "udp4",
        "outport": "",
        "base64": false,
        "multicast": "false",
        "x": 1130,
        "y": 460,
        "wires": []
    },
    {
        "id": "9e1cfc96dea4164e",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/goal",
        "payload": "{\"type\":\"i\",\"value\":0}",
        "payloadType": "json",
        "x": 230,
        "y": 420,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "37cf2fe1f81d595e",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/speed",
        "payload": "{\"type\":\"i\",\"value\":10}",
        "payloadType": "json",
        "x": 280,
        "y": 560,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "dc2c2c36bbca3fe1",
        "type": "osc",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "path": "",
        "metadata": false,
        "x": 490,
        "y": 880,
        "wires": [
            [
                "f33579b4754d0dfa"
            ]
        ]
    },
    {
        "id": "f33579b4754d0dfa",
        "type": "debug",
        "z": "f77fbd8e15e87f4e",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 880,
        "wires": []
    },
    {
        "id": "a79beafe7a788f14",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/speed",
        "payload": "{\"type\":\"i\",\"value\":150}",
        "payloadType": "json",
        "x": 280,
        "y": 600,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "2fe11019ee3327c7",
        "type": "udp in",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "iface": "",
        "port": "7000",
        "ipv": "udp4",
        "multicast": "false",
        "group": "",
        "datatype": "buffer",
        "x": 240,
        "y": 880,
        "wires": [
            [
                "dc2c2c36bbca3fe1"
            ]
        ]
    },
    {
        "id": "250c2faa7aa1e98e",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/go",
        "payload": "{\"type\":\"i\",\"value\":0}",
        "payloadType": "json",
        "x": 270,
        "y": 640,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "203c261a0e329239",
        "type": "pythonshell in",
        "z": "f77fbd8e15e87f4e",
        "name": "dynamixel",
        "pyfile": "/home/jhoepffner/dynamixel/pythonDynamixelOSC.py",
        "virtualenv": "/home/jhoepffner/dynamixel/env",
        "continuous": false,
        "stdInData": false,
        "x": 510,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "9580f57966c96d24",
        "type": "ui_button",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "group": "67d118469feea802",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "start",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 250,
        "y": 40,
        "wires": [
            [
                "203c261a0e329239"
            ]
        ]
    },
    {
        "id": "694f744feaec2ba5",
        "type": "ui_button",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "group": "67d118469feea802",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "goal 4096",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"type\":\"i\",\"value\":4096}",
        "payloadType": "json",
        "topic": "/goal",
        "topicType": "str",
        "x": 500,
        "y": 280,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "a8e075ede97464cd",
        "type": "ui_button",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "group": "67d118469feea802",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "goal 0",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"type\":\"i\",\"value\":0}",
        "payloadType": "json",
        "topic": "/goal",
        "topicType": "str",
        "x": 490,
        "y": 340,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "b806a2c327a1aa6f",
        "type": "ui_button",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "group": "67d118469feea802",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "speed 150",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"type\":\"i\",\"value\":150}",
        "payloadType": "json",
        "topic": "/speed",
        "topicType": "str",
        "x": 490,
        "y": 460,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "a4334153b9c928fe",
        "type": "ui_button",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "group": "67d118469feea802",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "speed 10",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"type\":\"i\",\"value\":10}",
        "payloadType": "json",
        "topic": "/speed",
        "topicType": "str",
        "x": 480,
        "y": 500,
        "wires": [
            [
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "99e67b583ba34f4d",
        "type": "arduino out",
        "z": "f77fbd8e15e87f4e",
        "name": "servo 8",
        "pin": "8",
        "state": "SERVO",
        "arduino": "5ff2cc38773219c0",
        "x": 480,
        "y": 1080,
        "wires": []
    },
    {
        "id": "91f54cce34821179",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "servo",
        "payload": "0",
        "payloadType": "num",
        "x": 170,
        "y": 1020,
        "wires": [
            [
                "99e67b583ba34f4d"
            ]
        ]
    },
    {
        "id": "90a5b546afd8e228",
        "type": "inject",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "servo",
        "payload": "180",
        "payloadType": "num",
        "x": 180,
        "y": 1140,
        "wires": [
            [
                "99e67b583ba34f4d"
            ]
        ]
    },
    {
        "id": "ccb9548bc416f6d0",
        "type": "ui_slider",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "label": "slider",
        "tooltip": "",
        "group": "67d118469feea802",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "/goal",
        "topicType": "str",
        "min": 0,
        "max": "4096",
        "step": 1,
        "className": "",
        "x": 130,
        "y": 220,
        "wires": [
            [
                "e82f3d051776f086",
                "ed3d84f66ecda862"
            ]
        ]
    },
    {
        "id": "04f98530e5b9af33",
        "type": "debug",
        "z": "f77fbd8e15e87f4e",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 840,
        "y": 340,
        "wires": []
    },
    {
        "id": "e82f3d051776f086",
        "type": "function",
        "z": "f77fbd8e15e87f4e",
        "name": "function 1",
        "func": "var newmsg = { \"type\": \"i\", \"value\": 4096 }\nreturn newmsg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 220,
        "wires": [
            [
                "04f98530e5b9af33"
            ]
        ]
    },
    {
        "id": "ed3d84f66ecda862",
        "type": "change",
        "z": "f77fbd8e15e87f4e",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"type\": \"i\", \"value\": \"{{payload}}\"}",
                "tot": "json"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "/goal",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 540,
        "y": 160,
        "wires": [
            [
                "04f98530e5b9af33",
                "87757859285292bd"
            ]
        ]
    },
    {
        "id": "67d118469feea802",
        "type": "ui_group",
        "name": "start",
        "tab": "6269638b855099fb",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "5ff2cc38773219c0",
        "type": "arduino-board",
        "device": "/dev/ttyACMO"
    },
    {
        "id": "6269638b855099fb",
        "type": "ui_tab",
        "name": "dynamixel",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<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:** [5 December 2023 19:40 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/5 "2023-12-05T19:40:38Z")

</div>

You can use the JSONata type input  
e.g.

```auto
[{"id":"ed3d84f66ecda862","type":"change","z":"f77fbd8e15e87f4e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"type\": \"i\", \"value\": $$.payload}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"/goal","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":160,"wires":[["04f98530e5b9af33","87757859285292bd"]]}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2023 19:49 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/6 "2023-12-05T19:49:04Z")

</div>

Is that the example flow which node-red-config-osc includes?

Does it work if you set msg.payload in a function node (I think this is what @E1cid suggested above)

```auto
msg.payload = {"type": "i", "value": msg.payload}
return msg

```

> [@jhoepffner](#):
>
> if I send  
> {"type": "i", "value": "{{payload}}"}, it doen't work.

I am not sure what you mean by "If I send...". Exactly where are you using that mustache syntax?

---

<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:** [5 December 2023 21:48 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/7 "2023-12-05T21:48:53Z")

</div>

Or you can do it without JSONata (which will use less processor overheads) using something like

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/d/8d989b6c5700cc7393af01a9ac18bc340aa8ab12.png)

---

<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:** [5 December 2023 22:22 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/8 "2023-12-05T22:22:01Z")

</div>

> [@Colin](#):
>
> (which will use less processor overheads)

Does it?  
In a simple test, JSONata in this simple task was faster approx 70% of the time.

 ![image21](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf21e41993e7eee8765cc5def2530b59ae45d619.jpeg)  
[edit add flow]

```auto
[{"id":"30490eb550612c82","type":"inject","z":"d1395164b4eec73e","name":"JSONata","props":[{"p":"time","v":"","vt":"date"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"123","payloadType":"str","x":80,"y":1740,"wires":[["ed3d84f66ecda862"]]},{"id":"ed3d84f66ecda862","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"type\": \"i\", \"value\": $$.payload}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"/goal","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":1740,"wires":[["e4b7c856aed1710e"]]},{"id":"e4b7c856aed1710e","type":"debug","z":"d1395164b4eec73e","name":"debug 2457","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"$millis()-$$.time","statusType":"jsonata","x":470,"y":1740,"wires":[]},{"id":"8cc5a5366e3fdcf0","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"temp","pt":"msg","to":"{\"type\":\"i\",\"value\":\"123\"}","tot":"json"},{"t":"set","p":"temp.value","pt":"msg","to":"payload","tot":"msg"},{"t":"move","p":"temp","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"/goal","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":1780,"wires":[["318d4e587f22f3db"]]},{"id":"feaf4cc73186c053","type":"inject","z":"d1395164b4eec73e","name":"json","props":[{"p":"time","v":"","vt":"date"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"123","payloadType":"str","x":70,"y":1780,"wires":[["8cc5a5366e3fdcf0"]]},{"id":"318d4e587f22f3db","type":"debug","z":"d1395164b4eec73e","name":"debug 2458","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"$millis()-$$.time","statusType":"jsonata","x":470,"y":1800,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2023 22:33 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/9 "2023-12-05T22:33:25Z")

</div>

Can you explain what the jsonata in the debug node does?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e719b52f01b24bde3100e86cfe88412c40622057.png)

---

<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:** [5 December 2023 22:50 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/10 "2023-12-05T22:50:03Z")

</div>

Thought it would be obvious. It takes the timestamp at beginning of flow and subtracts it from timestamp at end of flow.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 December 2023 23:13 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/11 "2023-12-05T23:13:39Z")

</div>

> [@E1cid](#):
>
> Thought it would be obvious

😂😂😂 JSONata, Obvious? You crack me up.

Oh wait. You're serious? 🫣

---

<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 December 2023 05:52 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/12 "2023-12-06T05:52:37Z")

</div>

Yes I am serious that the expression should be obvious to understand, i was not talking about JSONata as a whole.

Are you seriously suggesting you can not work out such a simple expression Steve. I understand you are not a JSONata fan, but the expression is really a simple one.

I will explain it for you seems you maybe having difficulty.

`$millis()` from change node editor

> Returns the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. All invocations of `$millis()` within an evaluation of an expression will all return the same value.and - another thing

`-` From most languages

> The subtraction operator subtracts the RHS value from the LHS value to produce the numerical difference It is an error if either operand is not a number.

`$$.time`

> The var set to a timestamp in milliseconds, in the initial inject node.

Hope that helps those who are having difficulty with such a simple expression.

Oh! sorry you where joking.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [6 December 2023 06:47 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/13 "2023-12-06T06:47:00Z")

</div>

I see now that "millis" enclosed between $ and () indicate a function built in to jsonata and which presumably takes no parameters, while $$ indicates a named property of the message to which the expression is applied, not a similarly built in function. msg.time of course is timestamp, the same measurement of milliseconds since that start time.

Probably I could have looked up $() and $$ or even guessed their meaning but I thought it useful to have an explanation in the forum where this interesting code was used, so I asked.

Thanks for taking the time to indulge me.

---

<div class="post-metadata">

**Author:** ![jhoepffner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhoepffner/32/69679_2.png) [@jhoepffner](https://discourse.nodered.org/u/jhoepffner)\
**Post date:** [7 December 2023 21:45 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/14 "2023-12-07T21:45:08Z")

</div>

Hello,  
Thank you to everybody!  
Unfortunately I just have a medical problem and for some days I am not in front of my computer.  
When I am back, I will test your propositions and answer properly.  
Have a nice day!

---

<div class="post-metadata">

**Author:** ![jhoepffner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhoepffner/32/69679_2.png) [@jhoepffner](https://discourse.nodered.org/u/jhoepffner)\
**Post date:** [9 December 2023 17:31 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/15 "2023-12-09T17:31:12Z")

</div>

Hello,

```auto
msg.payload = {"type": "i", "value": msg.payload}
return msg

```

doesn't works, if I debug, I receive

> {"type": "i", "value": "{{payload}}"}

but I need

> {"type": "i", "value": 1096}

(the value sended by the slider)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [9 December 2023 17:43 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/16 "2023-12-09T17:43:53Z")

</div>

I hope you are feeling better. 🙂

The only way that a function node containing exactly this

```auto
msg.payload = {"type": "i", "value": msg.payload}
return msg

```

results in this, with "{{payload}}" as a string literal

```auto
{"type":"i","value":"{{payload}}"}

```

is if msg.payload had been corrupted by a node earlier in the flow.

Please export your flow, including the slider, function and debug and all steps between and paste it here so we can test it.

---

<div class="post-metadata">

**Author:** ![jhoepffner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jhoepffner/32/69679_2.png) [@jhoepffner](https://discourse.nodered.org/u/jhoepffner)\
**Post date:** [9 December 2023 17:51 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/17 "2023-12-09T17:51:02Z")

</div>

Hello,  
Thank you! it works :=)  
I am now able to command a dynamixel motor through a raspberry:

- the raspberry pi is a wifi server, I can connect with wifi or RJ45
- a python script inside a bash started by node-red with dynamixel and python-osc libraries
- node-red send osc to python (/goal, /speed, /accel)
- I can send OSC from my favourite software, TouchDesigner and receive the actual position of the motor.  
Have a nice sunday.  
Jacques

---

<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:** [23 December 2023 17:51 UTC](https://discourse.nodered.org/t/problem-sending-slider-value-to-osc/83445/18 "2023-12-23T17:51:58Z")

</div>

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