Node-red怎么把收到的一串buffer数组中的两个数值合并成在一起再输出

image
[ 2, 3, 2, 180, 162, 10, 253 ]
如上面图片所示,收到的是一组数组的buffer,因为想要的数值是第四和第五的数值组合起来的,也就是180162,不知道有什么办法进行组合输出。

求大神指导下,下面是flow。

[ { “id”: “f6f2187d.f17ca8”, “type”: “tab”, “label”: “Flow 1”, “disabled”: false, “info”: “” }, { “id”: “368d30c6ea21487f”, “type”: “inject”, “z”: “f6f2187d.f17ca8”, “name”: “PS540角速度值”, “props”: [ { “p”: “payload” } ], “repeat”: “”, “crontab”: “”, “once”: false, “onceDelay”: 0.1, “topic”: “”, “payload”: “[2,3,0,3,0,1,116,57]”, “payloadType”: “bin”, “x”: 540, “y”: 280, “wires”: [ [ “e1928225e21cf584”, “99e06fdc2ffd354e”, “8b223d99e6b2e278” ] ] }, { “id”: “ed1cf85f0a728a11”, “type”: “debug”, “z”: “f6f2187d.f17ca8”, “name”: “”, “active”: false, “tosidebar”: true, “console”: false, “tostatus”: false, “complete”: “payload”, “targetType”: “msg”, “statusVal”: “”, “statusType”: “auto”, “x”: 970, “y”: 240, “wires”: [] }, { “id”: “8b223d99e6b2e278”, “type”: “buffer-parser”, “z”: “f6f2187d.f17ca8”, “name”: “”, “data”: “payload”, “dataType”: “msg”, “specification”: “spec”, “specificationType”: “ui”, “items”: [ { “type”: “buffer”, “name”: “00”, “offset”: 4, “length”: 2, “offsetbit”: 0, “scale”: “1”, “mask”: “” } ], “swap1”: “”, “swap2”: “”, “swap3”: “”, “swap1Type”: “swap”, “swap2Type”: “swap”, “swap3Type”: “swap”, “msgProperty”: “result”, “msgPropertyType”: “”, “resultType”: “value”, “resultTypeType”: “output”, “multipleResult”: true, “fanOutMultipleResult”: false, “setTopic”: false, “outputs”: 1, “x”: 790, “y”: 380, “wires”: [ [ “d7acf54d16e8a4e8” ] ] }, { “id”: “e1928225e21cf584”, “type”: “function”, “z”: “f6f2187d.f17ca8”, “name”: “msg”, “func”: “var msg5 = {payload:msg.payload[5]};\nvar msg6 = {payload:msg.payload[6]};\n\n\nreturn [msg5,msg6];\n”, “outputs”: 2, “noerr”: 0, “initialize”: “”, “finalize”: “”, “libs”: [], “x”: 790, “y”: 280, “wires”: [ [ “ed1cf85f0a728a11” ], [ “5c370a9dcc6663eb” ] ] }, { “id”: “5c370a9dcc6663eb”, “type”: “debug”, “z”: “f6f2187d.f17ca8”, “name”: “”, “active”: false, “tosidebar”: true, “console”: false, “tostatus”: false, “complete”: “payload”, “targetType”: “msg”, “statusVal”: “”, “statusType”: “auto”, “x”: 970, “y”: 300, “wires”: [] }, { “id”: “d7acf54d16e8a4e8”, “type”: “debug”, “z”: “f6f2187d.f17ca8”, “name”: “”, “active”: false, “tosidebar”: true, “console”: false, “tostatus”: false, “complete”: “payload”, “targetType”: “msg”, “statusVal”: “”, “statusType”: “auto”, “x”: 970, “y”: 380, “wires”: [] }, { “id”: “99e06fdc2ffd354e”, “type”: “debug”, “z”: “f6f2187d.f17ca8”, “name”: “”, “active”: true, “tosidebar”: true, “console”: false, “tostatus”: false, “complete”: “payload”, “targetType”: “msg”, “statusVal”: “”, “statusType”: “auto”, “x”: 970, “y”: 160, “wires”: [] } ]

解决了吗加粗示例

var temp = (msg.payload[3]+msg.payload[4]);
msg.payload = temp;
return msg;

感谢回复,试了一下,您这个应该是两个相加数字。有什么方法可以让两个 [ 2, 3, 2, 180, 162 , 10, 253 ] 组合起来吗?输出的结果为 180162

可能你也不需要答案了,逛进来了就留个言。
根据调试信息,复制需要的数值路径,新建一个buffer就可以了

msg.payload = new Buffer([msg.payload[3],msg.payload[4]]);
return msg;

[{"id":"24b722dec35294cf","type":"tab","label":"流程 1","disabled":false,"info":"","env":[]},{"id":"e501d54ed2cc28dc","type":"inject","z":"24b722dec35294cf","name":"buffer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[2,3,8,182,119,12,18]","payloadType":"json","x":430,"y":240,"wires":[["f333081db4c2d2e2","f5e3e305881cd259"]]},{"id":"f5e3e305881cd259","type":"debug","z":"24b722dec35294cf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":320,"wires":[]},{"id":"f333081db4c2d2e2","type":"function","z":"24b722dec35294cf","name":"","func":"msg.payload = new Buffer([msg.payload[3],msg.payload[4]]);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":220,"wires":[["f5e3e305881cd259"]]}]

你用180*1000再加后面的不就可以了吗