LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read  from arduino using Labview

Hi All,

     

I am reading the data from arduino UNO board through serial port using labview. This program reads two analog input of arduino and The output of serial data is 14 192  15 566 and this goes on till 100 number of samples. The 14 and 15 are the Analog channels port no which is used to recognise which data is from which analog channel.

 

I would like to separate the data corresponding to channel port no and store it in array. Can any one please tell me how I can separate the data corresponding to their device ID please.

 

Thank you!

0 Kudos
Message 1 of 2
(3,520 Views)
The simplest way is to write your arduino code to send both values at once with a comma between them and terminated with a carriage return. The pntln function adds the termination character for you. No need to use the channel id. The Spreadsheet String to Array can be used to separate the values. The VISA Read would be configured to detect the termination character and stop automatically when it is detected. An arbitrary high number of bytes to read is specified so the read set-up is simplified.

If your existing scheme appends a CR, then you would need to read x number of bytes to get the channel, pass that data to a case statement, read y number of bytes to get the data, and then write to one of two arrays (or one array and the appropriate column).

Numerous discussions on this subject and the LINX toolkit is available to create the necessary sketch.
0 Kudos
Message 2 of 2
(3,501 Views)