Sending different strings from an array over a serial port

I'm currently trying to build something to communicate with a controller via a COM/serial port. I use the "serial-request" module for this.

The controller accepts for communication:

"Communications format
• The commands are NOT case sensitive.
• All characters are ASCII characters.
• All functions are comma separated ‘,’ for write functions.
• All functions can be interrogated by applying question mark '?' as a separator for read back functionality.
• All lines must be terminated with a carriage return character (asc(13))
Important: The controller uses a microprocessor based Uart serial buffer. For reliability of communications, data must be sent 1 character at a time with a 4ms delay between each character.
Example: S delay V delay P delay , delay 1 delay 0 delay asc(13)"

To explain: Put simply, the commands are set values ​​and/or read values. I've started querying the version of the firmware. The command is "SVN?" for "SetVersionNumber?"

I finally got a response from the controller after a very long time of trying. (See attached flow) Since according to the manual the controller has to receive all messages one after the other and at intervals of 4 ms (whether that really works is questionable :smiley: ), I saved the values ​​as a buffer via "buffer parser" [13,83,86, 78.63] for the ASCII codes "SVN?" . "13" for carriage return must come first (usually at the back, but that doesn't work), then "S","V","N" and "?". The controller then gives me back its current version number as a string. It's still not ideal, I get more "undefined" back, but that's not the issue here.

However, my goal at some point is to send a large number of different commands (at best via UI). So I need a way to quickly pack "strings" into an array (either as such or cast to buffer) and send those individual values ​​to the controller one at a time. I searched for something like "Strings to Array" for this, but didn't really find anything useful.

[{"id":"3d637d0e35ea6ba5","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"2d88e3418c2fbae1","type":"inject","z":"3d637d0e35ea6ba5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":240,"wires":[["b8f0f45e4e6eda5b"]]},{"id":"b358ff15d34504e8","type":"debug","z":"3d637d0e35ea6ba5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1210,"y":240,"wires":[]},{"id":"bbc57fb0c229ccae","type":"serial request","z":"3d637d0e35ea6ba5","name":"","serial":"652032530abaf805","x":870,"y":240,"wires":[["b358ff15d34504e8"]]},{"id":"b8f0f45e4e6eda5b","type":"buffer-parser","z":"3d637d0e35ea6ba5","name":"","data":"[13,83,86,78,63]","dataType":"bin","specification":"spec","specificationType":"ui","items":[{"type":"ascii","name":"item1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"ascii","name":"item2","offset":1,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"ascii","name":"item3","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"ascii","name":"item4","offset":3,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"ascii","name":"item5","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":true,"setTopic":false,"outputs":5,"x":570,"y":240,"wires":[["bbc57fb0c229ccae"],["bbc57fb0c229ccae"],["bbc57fb0c229ccae"],["bbc57fb0c229ccae"],["bbc57fb0c229ccae"]]},{"id":"652032530abaf805","type":"serial-port","serialport":"COM5","serialbaud":"19200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"$","bin":"false","out":"char","addchar":"","responsetimeout":"4"}]

You probably have buffered comms from failed attempts (try resetting the end device)


You may want to modularise the data you are sending. Here are some ideas...

Demo flow...

[{"id":"2d88e3418c2fbae1","type":"inject","z":"3d637d0e35ea6ba5","name":"A buffer of [13,83,86,78,63]","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[13,83,86,78,63]","payloadType":"bin","x":290,"y":160,"wires":[["5cbd1f7edc07078c"]]},{"id":"b358ff15d34504e8","type":"debug","z":"3d637d0e35ea6ba5","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":160,"wires":[]},{"id":"bbc57fb0c229ccae","type":"serial request","z":"3d637d0e35ea6ba5","name":"","serial":"652032530abaf805","x":990,"y":160,"wires":[["b358ff15d34504e8"]]},{"id":"2a921ef6265f1c1c","type":"inject","z":"3d637d0e35ea6ba5","name":"3 arrays","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[13,83,86,78,63],[13,83,86,78,63],[13,83,86,78,63]]","payloadType":"json","x":240,"y":220,"wires":[["df5ab1d0b9eaac8b"]]},{"id":"df5ab1d0b9eaac8b","type":"split","z":"3d637d0e35ea6ba5","name":"split arrays into single array messages","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":470,"y":220,"wires":[["5cbd1f7edc07078c"]]},{"id":"6cc5938d9590f1a6","type":"link call","z":"3d637d0e35ea6ba5","name":"","links":["4ea03f6008708992"],"linkType":"static","timeout":"30","x":710,"y":840,"wires":[["739d46c8ce75b899"]]},{"id":"4ea03f6008708992","type":"link in","z":"3d637d0e35ea6ba5","name":"split and space out","links":[],"x":175,"y":580,"wires":[["2b7c7614f65061c1"]]},{"id":"e1a7092a4ab34b66","type":"link out","z":"3d637d0e35ea6ba5","name":"link out 17","mode":"return","links":[],"x":995,"y":580,"wires":[]},{"id":"edb79338b9bff1e7","type":"split","z":"3d637d0e35ea6ba5","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":640,"y":580,"wires":[["27df2586363707d1"]]},{"id":"5110c78d27e2765c","type":"inject","z":"3d637d0e35ea6ba5","name":"A buffer of [13,83,86,78,63]","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[13,83,86,78,63]","payloadType":"bin","x":290,"y":840,"wires":[["6cc5938d9590f1a6"]]},{"id":"739d46c8ce75b899","type":"debug","z":"3d637d0e35ea6ba5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":840,"wires":[]},{"id":"27df2586363707d1","type":"delay","z":"3d637d0e35ea6ba5","name":"rate limit 1 msg per 0.004s","pauseType":"rate","timeout":"4","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"0.004","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":830,"y":580,"wires":[["e1a7092a4ab34b66"]]},{"id":"2b7c7614f65061c1","type":"buffer-parser","z":"3d637d0e35ea6ba5","name":"To byte array","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"byte","name":"bytes","offset":0,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":290,"y":580,"wires":[["3b9c1ed5bfa97671"]]},{"id":"3b9c1ed5bfa97671","type":"change","z":"3d637d0e35ea6ba5","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.bytes","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":580,"wires":[["edb79338b9bff1e7"]]},{"id":"fd6c18b42ea2689f","type":"comment","z":"3d637d0e35ea6ba5","name":"DEBUGGING: Testing the subroutines","info":"","x":310,"y":740,"wires":[]},{"id":"22f714ce8bac7760","type":"comment","z":"3d637d0e35ea6ba5","name":"SUBROUTINE: Split and space out ...................................................................................................................................................","info":"","x":590,"y":540,"wires":[]},{"id":"5cbd1f7edc07078c","type":"link call","z":"3d637d0e35ea6ba5","name":"","links":["4ea03f6008708992"],"linkType":"static","timeout":"30","x":730,"y":160,"wires":[["625c560a43bf46b8","bbc57fb0c229ccae"]]},{"id":"625c560a43bf46b8","type":"debug","z":"3d637d0e35ea6ba5","name":"data byte","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":220,"wires":[]},{"id":"52f8a745bac31845","type":"inject","z":"3d637d0e35ea6ba5","name":"3 arrays","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[13,83,86,78,63],[13,83,86,78,63],[13,83,86,78,63]]","payloadType":"json","x":240,"y":900,"wires":[["2598ee4f36eae3f7"]]},{"id":"2598ee4f36eae3f7","type":"split","z":"3d637d0e35ea6ba5","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":370,"y":900,"wires":[["20ac53d00c366258"]]},{"id":"7b018ad985b877f6","type":"inject","z":"3d637d0e35ea6ba5","name":"VFS?","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"VFS?","payloadType":"str","x":230,"y":100,"wires":[["baaaf9e14709cd98"]]},{"id":"40a00497b4a476e5","type":"inject","z":"3d637d0e35ea6ba5","name":"VFS?","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"VFS?","payloadType":"str","x":230,"y":780,"wires":[["17beed4cdef950ad"]]},{"id":"8877e9c2d4862a58","type":"link in","z":"3d637d0e35ea6ba5","name":"String-to-Buffer","links":[],"x":175,"y":500,"wires":[["087baefe869e858b"]]},{"id":"daa9c9a7e866dd8b","type":"link out","z":"3d637d0e35ea6ba5","name":"link out 18","mode":"return","links":[],"x":595,"y":500,"wires":[]},{"id":"f71d07b00eeb8255","type":"comment","z":"3d637d0e35ea6ba5","name":"SUBROUTINE: String to Buffer + newline ..................................","info":"","x":390,"y":460,"wires":[]},{"id":"087baefe869e858b","type":"buffer-maker","z":"3d637d0e35ea6ba5","name":"String to Buffer + lineFeed (ASCII 10)","specification":"spec","specificationType":"ui","items":[{"name":"stringData","type":"ascii","length":-1,"dataType":"msg","data":"payload"},{"name":"lineFeed","type":"byte","length":1,"dataType":"num","data":"10"}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","x":390,"y":500,"wires":[["daa9c9a7e866dd8b"]]},{"id":"17beed4cdef950ad","type":"link call","z":"3d637d0e35ea6ba5","name":"","links":["8877e9c2d4862a58"],"linkType":"static","timeout":"30","x":400,"y":780,"wires":[["6cc5938d9590f1a6"]]},{"id":"baaaf9e14709cd98","type":"link call","z":"3d637d0e35ea6ba5","name":"","links":["8877e9c2d4862a58"],"linkType":"static","timeout":"30","x":400,"y":100,"wires":[["5cbd1f7edc07078c"]]},{"id":"20ac53d00c366258","type":"delay","z":"3d637d0e35ea6ba5","name":"","pauseType":"rate","timeout":"4","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":520,"y":900,"wires":[["6cc5938d9590f1a6"]]},{"id":"652032530abaf805","type":"serial-port","serialport":"COM5","serialbaud":"19200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"$","bin":"false","out":"char","addchar":"","responsetimeout":"4"}]

FYI, how the link-call works...

1 Like

Oh thank you! That's just good work! That'll get me further.

one quenstion (i am sure, there will be more):

In the node "buffer maker": If I set length to "-1" (e.g. line for ASCII), is this a trick to set it to the required length?

Your question doesnt align with my head (so the answer is possibly yes) but I will explain to be sure..

Setting a length -1 means "use all of the data"

e.g. if you send a value of "HELLO" and ask for length 2 you will get a buffer of 48 45 however if you ask for length -1 you get all 5 characters 48 45 4c 4c 4f

This is what the built in help says...

length: The quantity of items to be written to the buffer. e.g. 12 floats or 34 int32s. NOTE: setting length to -1 will attempt to read all data items from the input data...

Yes, that's exactly what I was getting at. And sorry, I should read the help more carefully.

As you know, I need ASCII "CR" as the beginning of the sending message. For these cases, how can I add a (always the same) value to the first position in an array? In my example "13" on the first position in the array.

I tried to use a function with "array.unshift ()", but it's not working yet. How do i handle this?

Array.unshift doesn't work as it is a Buffer, not an Array. This should do it

const nl = Buffer.from([13])
msg.payload = Buffer.concat( [nl, msg.payload] )
return msg;

As I said before, it is doubtful you need a carriage return at the beginning...

But hey ho of it works.

As for how to add a carriage return, simply put a byte in the buffer maker (at the top of the list) & set it's value to 13

Of course, carriage return at the beginning is unlogical, but I couldn't find any buffered commands or reset the controller.

This is just an easy way, thanks. I also used Colin's solution and wrote a function.

If you're still interested, here's the final flow (most of the work was done by Steve-Mcl, thanks a lot)

[
    {
        "id": "25115a9205cb179b",
        "type": "tab",
        "label": "Flow 7",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "a2fcda1461c0ad20",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "A buffer of [13,83,86,78,63]",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[13,83,86,78,63]",
        "payloadType": "bin",
        "x": 230,
        "y": 160,
        "wires": [
            [
                "f50d9ff85ac5d511"
            ]
        ]
    },
    {
        "id": "09937bc74c86f7c8",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1550,
        "y": 160,
        "wires": []
    },
    {
        "id": "5bc716610671b119",
        "type": "serial request",
        "z": "25115a9205cb179b",
        "name": "",
        "serial": "652032530abaf805",
        "x": 1290,
        "y": 160,
        "wires": [
            [
                "09937bc74c86f7c8"
            ]
        ]
    },
    {
        "id": "733f6e9d3f88c634",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "3 arrays",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[[13,83,86,78,63],[13,83,86,78,63],[13,83,86,78,63]]",
        "payloadType": "json",
        "x": 180,
        "y": 240,
        "wires": [
            [
                "deee9cf29dfdfe1c"
            ]
        ]
    },
    {
        "id": "deee9cf29dfdfe1c",
        "type": "split",
        "z": "25115a9205cb179b",
        "name": "split arrays into single array messages",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 490,
        "y": 240,
        "wires": [
            [
                "f50d9ff85ac5d511"
            ]
        ]
    },
    {
        "id": "c41ce46861fb7c84",
        "type": "link call",
        "z": "25115a9205cb179b",
        "name": "",
        "links": [
            "84f9092da9772487"
        ],
        "timeout": "30",
        "x": 770,
        "y": 820,
        "wires": [
            [
                "8b4e254311072f42"
            ]
        ]
    },
    {
        "id": "84f9092da9772487",
        "type": "link in",
        "z": "25115a9205cb179b",
        "name": "split and space out",
        "links": [],
        "x": 135,
        "y": 560,
        "wires": [
            [
                "7fc26a18c529e88b"
            ]
        ]
    },
    {
        "id": "a4c453a8cff80cad",
        "type": "link out",
        "z": "25115a9205cb179b",
        "name": "link out 17",
        "mode": "return",
        "links": [],
        "x": 1005,
        "y": 560,
        "wires": []
    },
    {
        "id": "1e8f0f0fd4875a8b",
        "type": "split",
        "z": "25115a9205cb179b",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 600,
        "y": 560,
        "wires": [
            [
                "a4c453a8cff80cad"
            ]
        ]
    },
    {
        "id": "a9bc3f158bdcdc06",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "A buffer of [13,83,86,78,63]",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[13,83,86,78,63]",
        "payloadType": "bin",
        "x": 250,
        "y": 820,
        "wires": [
            [
                "c41ce46861fb7c84"
            ]
        ]
    },
    {
        "id": "8b4e254311072f42",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1110,
        "y": 820,
        "wires": []
    },
    {
        "id": "fcd1829681bd95f7",
        "type": "delay",
        "z": "25115a9205cb179b",
        "name": "rate limit 1 msg per 0.004s",
        "pauseType": "rate",
        "timeout": "4",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "0.004",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": true,
        "outputs": 1,
        "x": 800,
        "y": 560,
        "wires": [
            [
                "b523fae2cd9c4e91"
            ]
        ]
    },
    {
        "id": "7fc26a18c529e88b",
        "type": "buffer-parser",
        "z": "25115a9205cb179b",
        "name": "To byte array",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "byte",
                "name": "bytes",
                "offset": 0,
                "length": -1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 250,
        "y": 560,
        "wires": [
            [
                "f95f91d71154f654"
            ]
        ]
    },
    {
        "id": "f95f91d71154f654",
        "type": "change",
        "z": "25115a9205cb179b",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.bytes",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 440,
        "y": 560,
        "wires": [
            [
                "1e8f0f0fd4875a8b"
            ]
        ]
    },
    {
        "id": "d3fd829d2904048b",
        "type": "comment",
        "z": "25115a9205cb179b",
        "name": "DEBUGGING: Testing the subroutines",
        "info": "",
        "x": 270,
        "y": 720,
        "wires": []
    },
    {
        "id": "72bfa7b0f43569d9",
        "type": "comment",
        "z": "25115a9205cb179b",
        "name": "SUBROUTINE: Split and space out ...................................................................................................................................................",
        "info": "",
        "x": 550,
        "y": 520,
        "wires": []
    },
    {
        "id": "f50d9ff85ac5d511",
        "type": "link call",
        "z": "25115a9205cb179b",
        "name": "",
        "links": [
            "84f9092da9772487"
        ],
        "timeout": "30",
        "x": 830,
        "y": 160,
        "wires": [
            [
                "267f4aca46af114a"
            ]
        ]
    },
    {
        "id": "03ef5035195d70f0",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "3 arrays",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[[13,83,86,78,63],[13,83,86,78,63],[13,83,86,78,63]]",
        "payloadType": "json",
        "x": 200,
        "y": 880,
        "wires": [
            [
                "97ef1658b96594c5"
            ]
        ]
    },
    {
        "id": "97ef1658b96594c5",
        "type": "split",
        "z": "25115a9205cb179b",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 330,
        "y": 880,
        "wires": [
            [
                "87f5b04016e6be78"
            ]
        ]
    },
    {
        "id": "21405ae10235d5b8",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "Command to controller?",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "SVP?",
        "payloadType": "str",
        "x": 220,
        "y": 80,
        "wires": [
            [
                "ea0bf94fa636f7cb"
            ]
        ]
    },
    {
        "id": "e91c4873fcb1e11e",
        "type": "inject",
        "z": "25115a9205cb179b",
        "name": "SVN?",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "SVN?",
        "payloadType": "str",
        "x": 190,
        "y": 760,
        "wires": [
            [
                "4b89d347dcc0ebad"
            ]
        ]
    },
    {
        "id": "cfe5b00d586ef486",
        "type": "link in",
        "z": "25115a9205cb179b",
        "name": "String-to-Buffer",
        "links": [],
        "x": 135,
        "y": 480,
        "wires": [
            [
                "1803bfb110594b07"
            ]
        ]
    },
    {
        "id": "5ae1560a0296c2a2",
        "type": "link out",
        "z": "25115a9205cb179b",
        "name": "link out 18",
        "mode": "return",
        "links": [],
        "x": 555,
        "y": 480,
        "wires": []
    },
    {
        "id": "98d3b2b76df98a5b",
        "type": "comment",
        "z": "25115a9205cb179b",
        "name": "SUBROUTINE: String to Buffer + newline ..................................",
        "info": "",
        "x": 350,
        "y": 440,
        "wires": []
    },
    {
        "id": "1803bfb110594b07",
        "type": "buffer-maker",
        "z": "25115a9205cb179b",
        "name": "String to Buffer + lineFeed (ASCII 10)",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "name": "stringData",
                "type": "ascii",
                "length": -1,
                "dataType": "msg",
                "data": "payload"
            },
            {
                "name": "lineFeed",
                "type": "byte",
                "length": 1,
                "dataType": "num",
                "data": "10"
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "x": 350,
        "y": 480,
        "wires": [
            [
                "5ae1560a0296c2a2",
                "8dd46387e75bea4b"
            ]
        ]
    },
    {
        "id": "4b89d347dcc0ebad",
        "type": "link call",
        "z": "25115a9205cb179b",
        "name": "",
        "links": [
            "cfe5b00d586ef486"
        ],
        "timeout": "30",
        "x": 360,
        "y": 760,
        "wires": [
            [
                "c41ce46861fb7c84"
            ]
        ]
    },
    {
        "id": "ea0bf94fa636f7cb",
        "type": "link call",
        "z": "25115a9205cb179b",
        "name": "",
        "links": [
            "cfe5b00d586ef486"
        ],
        "timeout": "30",
        "x": 420,
        "y": 80,
        "wires": [
            [
                "03d52a67d5ef29d0",
                "be5f056df2ad6e6a"
            ]
        ]
    },
    {
        "id": "87f5b04016e6be78",
        "type": "delay",
        "z": "25115a9205cb179b",
        "name": "",
        "pauseType": "rate",
        "timeout": "4",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 520,
        "y": 880,
        "wires": [
            [
                "c41ce46861fb7c84"
            ]
        ]
    },
    {
        "id": "03d52a67d5ef29d0",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 40,
        "wires": []
    },
    {
        "id": "b523fae2cd9c4e91",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1050,
        "y": 640,
        "wires": []
    },
    {
        "id": "267f4aca46af114a",
        "type": "function",
        "z": "25115a9205cb179b",
        "name": "buffer to string",
        "func": "msg.payload = Buffer.from([msg.payload]);\nmsg.payload = msg.payload.toString();\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1060,
        "y": 160,
        "wires": [
            [
                "5bc716610671b119",
                "62b4fa5b208435f3"
            ]
        ]
    },
    {
        "id": "291530279ba143fc",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1150,
        "y": 80,
        "wires": []
    },
    {
        "id": "be5f056df2ad6e6a",
        "type": "function",
        "z": "25115a9205cb179b",
        "name": "set \"Carriage Return\" (\"13\") to first position of each buffer",
        "func": "const nl = Buffer.from([13])\nmsg.payload = Buffer.concat( [nl, msg.payload] )\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 80,
        "wires": [
            [
                "f50d9ff85ac5d511",
                "291530279ba143fc"
            ]
        ]
    },
    {
        "id": "62b4fa5b208435f3",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1330,
        "y": 100,
        "wires": []
    },
    {
        "id": "8dd46387e75bea4b",
        "type": "debug",
        "z": "25115a9205cb179b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 380,
        "wires": []
    },
    {
        "id": "652032530abaf805",
        "type": "serial-port",
        "serialport": "COM5",
        "serialbaud": "19200",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "dtr": "none",
        "rts": "none",
        "cts": "none",
        "dsr": "none",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": "",
        "responsetimeout": "4"
    }
]

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