Thanks, I figured that out finally my self too, but still was not working so build a test system to see the data on terminal. Everything looked fine until I realised low and high byte where on wrong order. Fixing that and now it works
I am just begining with node RED and everything is still very new for me, coming from LabView and C, it is very strange how loosely variables are defined and that I can not route data to the icon output I want and everything comes in from one input.
Might be worth you spending an hour watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point & contains a few gold nuggets you might otherwise miss.
Ps, There is a contrib node that might be of interest - node-red-contrib-buffer-parser to help with reading and writing buffers.
Is there a way to select the serial port from dashboard? Now I am setting it on the serial port configuration , but would be needed to be be able to select the right serial port from dashboard from a list of available serial ports.
But is seems the solution would be pretty simple if the Serial port nodes would provide out the available serial ports it already well detects. What would it require to make that data available?
If we use this with our camera control device, the customer should be easily able to select the port from user interface, or better I could make polling on available ports to find out if the device is connected, but would need the available ports and way to select the port other than from the node configuration.
And it rather should work the same on all platforms.
Multible serial ports could maybe work on Windoews as they are called COM5 etc. but on linux and macOS the port names do not have any predefined structure that I know of.
Someone to look at the source code, discuss with one of the leaders how they would approach the modifications & finally a pull request.
Note, I don't think it will be quite as simple as you think (you would need to have some kind of control message structure that can query ports, stop start ports & set settings of the port). Quite a restructuring of the current serial port nodes.
Another possibility is to allow the user to specify the serial port to use via the dashboard and use that input to write a file containing, for example process.env.SERIAL_PORT = "/dev/ttyUSB0"
and then automatically restart node-red. In settings.js require that file so that when node-red is restarted it will make that environment variable available. In the serial port specify that the SERIAL_PORT env var is to be used.
The Serial node has the list of available serial ports, they are visible on the serial port configuration. I hope there would be interface to get the list of available serial ports from the Serial port node, so the selection of serial port could be done on dashboard, not in the coding environment.
I am still very much lost with all the terminology but can pick key words and google, but I think the functionality I am requesting is quite obvious, and still wondering if I am just missing something.
Yes the functionality is available on the node configuration, just would want that configuration to be available on dashboard, and/or list of available ports available to be used in function node and some way to select the port to be used from function node.
What I mean is if you look at the source code behind that functionality on the serial node, you could duplicate that in a function node. Once you have a list or array of serial ports in a function, it is very easy to pass this to the dashboard.
However this code will probably need access to modules like OS or FS. A function node ordinarily, does not have access to these modules so you will need to modify settings.js to include any extra modules. See here
Hopefully that is clearer?
Ps, once v1.3 of node-red is released, modifying settings.js is no longer a requirement (v1.3 function node has new UI elements to specify access to additional modules)