I have tried the following flow, but get no output. The debug shows error messages.
I wish there was a way to freeze the debug output so I could read it or copy it.
The debug of the JSON node says: unexpected token { in JSON at position 38
The debug output from com4 moves by so quickly I can't read it. But it seems to just show the data, {"leftDistance": 175, "centerDistance": 0}
I am trying the following in the function node, based on an example, but clearly I am screwing things up
var leftDistance = msg.payload[0].leftDistance;
msg.payload = leftDistance;
return msg;
Below is my flow.
[{"id":"5eca83b9.0365dc","type":"serial in","z":"4284f9c0.bf64b8","name":"","serial":"c8d31ac4.444c58","x":200.625,"y":423.93749237060547,"wires":[["95d95f96.7fce1","d54e539f.1df66","c9d00bf4.cfc0f8"]]},{"id":"95d95f96.7fce1","type":"ui_text","z":"4284f9c0.bf64b8","group":"e35c4135.063af","order":0,"width":0,"height":0,"name":"","label":"text output serial","format":"{{msg.payload}}","layout":"row-spread","x":508.125,"y":429.18750762939453,"wires":[]},{"id":"d54e539f.1df66","type":"json","z":"4284f9c0.bf64b8","name":"","property":"payload","action":"","pretty":false,"x":387.5,"y":476.45001220703125,"wires":[["ca37edab.a4253"]]},{"id":"c9d00bf4.cfc0f8","type":"debug","z":"4284f9c0.bf64b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":328.5,"y":598.2999877929687,"wires":[]},{"id":"ca37edab.a4253","type":"function","z":"4284f9c0.bf64b8","name":"","func":"var leftDistance = msg.payload[0].leftDistance;\nmsg.payload = leftDistance;\nreturn msg;\n","outputs":1,"noerr":0,"x":543.5,"y":488.45001220703125,"wires":[["508ad3d9.982fec"]]},{"id":"508ad3d9.982fec","type":"ui_text","z":"4284f9c0.bf64b8","group":"e35c4135.063af","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":682.5,"y":487.3499755859375,"wires":[]},{"id":"c8d31ac4.444c58","type":"serial-port","z":"","serialport":"COM4","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":true},{"id":"e35c4135.063af","type":"ui_group","z":"","name":"serial to arduino","tab":"e5eacb1c.ee1f78","disp":true,"width":"23","collapse":false},{"id":"e5eacb1c.ee1f78","type":"ui_tab","z":"","name":"Test serial arduino to pi","icon":"dashboard","order":3}]