03-24-2015 07:06 PM
I want to be able to find all the serial ports of the connected devices, specially arduinos.
Can someone tell me how to do this in labview, for linux systems?
Thanks.
03-24-2015 07:57 PM - edited 03-24-2015 08:05 PM
I wish to use only the com port with the last number. for example if I have ports 1,2,3, I want to use 3 and if that on is disconnected the 2, and so on.
Can someone please tell me how to do this and If you could please give me an example?
I wrote the title wrong, I just want to be able to discover every serial port on a machine. I will be doing so in linux, but that does not matter.
Thanks.
03-25-2015 09:16 AM
03-25-2015 11:23 AM
03-25-2015 11:29 AM
03-25-2015 11:46 PM
Hello Nando,
It would be a similar solution than the solution of your other post:
Linux Battery Monitor:
http://forums.ni.com/t5/LabVIEW/Linux-Battery-Monitor/m-p/3108799#M891139
But in this case I only want to remind you that there are not a COM1 port on Linux, on Linux the serial ports resources are called tty's, for example, the COM1 port on Windows its called ttyS0 on Linux. Linux also differentiates the USB Serial Ports (like the USB Serial Port of the Arduino) and name them as ttyUSB*
You can run the following command to get a list of the tty's ports:
$ dmesg | grep tty
You can run the following command to get a list of the ttyUSB's ports (the Arduino uses FTDI, so you will find all the Arduino ttyUSB's):
$ dmesg | grep 'FTDI USB Serial Device converter now attached'
Output:
[36051.393350] usb 4-2: FTDI USB Serial Device converter now attached to ttyUSB1
[36061.823513] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB0
Once you have the output string, you only have to parse the strings and as Dennis_Knutson said, use the Array functions to get the last ttyUSB port.
Best regards.