LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Serial Read and Write -> X Y Graph

Solved!
Go to solution

Hi everyone,

unfortunatelly i'm a newbie with labview, i've just started using it.

I'm receiving from an arduino serial coordinates X and Y using a Advanced Serial Read and Write and i would like to plot them in realtime in a XY Graph.

How could i proceed? I need to split the input strings in order to distinguish X and Y values. 

 

Thank you

Stefano

0 Kudos
Message 1 of 8
(5,859 Views)
How exactly is the arduino sending the data? Do you specifically request x and then y? Or, does the x and y come as a single string? Are you using the Linx toolkit for the arduino?
0 Kudos
Message 2 of 8
(5,853 Views)

Hi, i'm not using LINX neither the add-on "Interface for Arduino". That's too difficult and complicated for my scope.

 

I'm just sending via serial strings from arduino using the command

 

 Serial.println(xvalue);

 Serial.println(yvalue);

 

then i'm reading (and it works) the strings with the file.vi attached

in this .vi i'm sending via serial only one value and i was trying to plot it with a waveform but i don't know why it doesn't work.

 

My aim is to send x and y values consecutively, separate them, and to plot a XY graph in real time.

 

Thank you again


Stefano

 

0 Kudos
Message 3 of 8
(5,845 Views)
That's not a very smart way to send the data. There is no synchronization between the pc and the arduino so you have no idea which is x or which is y. Far better would be to send a single string with the two values separated by a comma or a space.
0 Kudos
Message 4 of 8
(5,828 Views)

I could do it, nice idea!

But as i am a newbie with LabView however i don't know how to separate them and how to plot them.

Could you help me in doing this?

0 Kudos
Message 5 of 8
(5,824 Views)
It could be done with the Spreadsheet String to Array. Then you simply use the Index Array to get the individual values. To use an xy graph, the simplest way at this point would be to use the express xy. You can pass scalars to it. With a normal xy graph, you would need to use two shift registers and a build array for each in order to provide the separate x and y arrays.
0 Kudos
Message 6 of 8
(5,818 Views)

Thank you for your advice. I'm going to try.

0 Kudos
Message 7 of 8
(5,809 Views)
Solution
Accepted by topic author stex2005

Hi,

 

could you have a look at file.vi attached?

 

The Express XY Graph works, now i need to plot a each of the two values (x and y) in function of time with a Waveform struct, but if a connect the outputs of the scan directly to the waveform it appears an error. How could i fix it?

 

Thank You

 

Stefano

0 Kudos
Message 8 of 8
(5,774 Views)