From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have five sensors connected to Arduino , how can I transfer their data to labview using serial port in an array? what is the Arduino and Labview code

I have five sensors connected to Arduino, how can I transfer their data to labview , using serial port as an array? what is the Arduino and Labview code ?

0 Kudos
Message 1 of 4
(2,511 Views)

in your Arduino code you should implement a querry based or continiously streaming architecture and make the corresponding visa driver on the labview side.  The streaming is easier to implement but less convienent to use in the long run from the labview side.

 

The quick and dirty method

Arduino:

 

periodically

Serial.write(str) where the str is a string with "sensorVal1, sensor2Val, sensorVal3, sensor4Val, sensorVal5 crlf"

 

 

and on LabView

 

Visa Open - same com settings as arduino (baud, parity...)

read until crlf

Parse the string for the 5 sensor values.

 

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 4
(2,492 Views)

many thanks

 

That makes more sense than the array, but frankly im very new to LV and i dont understand the code you wrote for lavbiew can you please explain it a bit more ?

 

0 Kudos
Message 3 of 4
(2,423 Views)

This is pseudocode.

You can look at the example code for visa serial read.  Set up the serial to match the arduino setup and read using the same terminal character, you should get the string that the arduino is sending.  Once you have this use scan from string to parse the individule sensors back out. 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 4
(2,414 Views)