From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Add More Then One Variable from Labview to Arduino?

Greetings, I'm new to both Labview and Arduino.

 

I'd like to know how to transfer more than one variable (whether it be a char or int) from Labviw to Arduino.

For example, imagine that in my Arduino code I have z = x +y (with all my variables properly declared beforehand). How would I transfer the values of x and y from Labview to Arduino?

0 Kudos
Message 1 of 3
(3,363 Views)

In order to transfer any data via serial communication, you need to break it down into 8-bit segments (a U8 array in LabVIEW).  Then, in LabVIEW, you would need to convert that U8 array to a string and send that using NI VISA.  Then, when you receive the bytes in the Arduino, you would need to reconstruct them before using them in a formula.

 

How you break down the values will depend on what type of data you are sending, what precision you need, how fast you need the data to be transmitted, etc.

 

One of the easier to understand methods is to convert the value to a string, transmit that string, and then read the string and use a string to number function in Arduino.

 

 

Message 2 of 3
(3,341 Views)

HI Nathan,

I am doing a project and I faced the same problem of InesSilva . and it's really nice to see your answer to this question after much research, yet I didn't fully understand your answer to InesSilva's problem (still beginner). can you explain it more with code if possible?

 

thanks a lot

musab 

0 Kudos
Message 3 of 3
(3,066 Views)