Hello everyone
I'm trying to send a buffer or array, created in a function-block, with the serial-out-block.
The problem now is, that the array is sent within the message.payload information. So the array-information are sourounded with "[", array-elements are separeted with ",". But i need only the "raw-array-informations" in uint8.
In the picture you can see the data transmitted by node-red and recorded with an analyzer. Note the "[", the "," and that the array-elements are transmitted in ascii.
Node-Details:
Function:
(only allowed two insert to pics, sorry)
Serial out:
Node-export:
[{"id":"e02fb919.30ccb8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"98cb9d7a.3815d","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"15","bin":"bin","out":"time","addchar":"","responsetimeout":"10000"},{"id":"1c06d1e8.bdb2c6","type":"serial out","z":"e02fb919.30ccb8","name":"","serial":"98cb9d7a.3815d","x":680,"y":280,"wires":[]},{"id":"946d00db.4cdfa8","type":"function","z":"e02fb919.30ccb8","name":"Telegramm","func":"var telegramm= {};\n\n/* raw array*/\nvar data = new Array([\n 0x55,\n 0x0f,\n 3,\n 255,\n 244,\n 57,\n 126,\n 159,\n 0,\n 0x20,\n 0x40,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0xff,\n ]);\n\n/* calculate the Checksum */\nvar uint8 = new Uint8Array(1);\nfor(i = 0; i < 15; i++)\n{\n uint8[0] += data[0][i];\n}\nuint8[0] = (uint8[0] ^ 0xff ) + 1;\ndata[0][15] = uint8[0];\ntelegramm.payload = data;\n\nreturn telegramm;\n","outputs":1,"noerr":0,"x":480,"y":280,"wires":[["1c06d1e8.bdb2c6","c4fd038a.a2672"]]},{"id":"45696429.06fa04","type":"inject","z":"e02fb919.30ccb8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":280,"wires":[["946d00db.4cdfa8"]]},{"id":"c4fd038a.a2672","type":"debug","z":"e02fb919.30ccb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":340,"wires":[]},{"id":"275a69d.97b2896","type":"serial in","z":"e02fb919.30ccb8","name":"","serial":"98cb9d7a.3815d","x":220,"y":120,"wires":[["f163fcee.7d88d8"]]},{"id":"f163fcee.7d88d8","type":"debug","z":"e02fb919.30ccb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":440,"y":120,"wires":[]}]
Thank you for your support.
Julian