LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino - Labview - Ultrasonic Sensors

Solved!
Go to solution

Hello people! We have to do a project for school and we decided to program 2 Ultrasonic Sensors with Arduino Uno and let the output Signals shown on a Graph on Labview.

Our problem is, that we can't convert the Data, coming from Arduino, into 2 different Signals. We don't see anything on the Graph, on read buffer or on the output 2.

I sent the programs into this feed. I hope someone has a solution for the problem.

 

Thanks and see ya!

Download All
0 Kudos
Message 1 of 8
(2,165 Views)

Hi Snyko,

 

unfortunately you use LV2022 for you rVI, which I cannot open. It would help to downconvert for older LV versions, like LV2019!

 

On your Arduino code: I recommend to change the sent string into something like "number:value", where "number" is a unique identifier for your sensor and "value" it's value. This way you can parse the strings in LabVIEW more easily and decide which value belongs to which sensor…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,128 Views)

Here is the program for another version, I hope you can open it now. Thanks for your help!

0 Kudos
Message 3 of 8
(2,123 Views)

Hi Snyko,

 

several suggestions:

- Use InitSerialPort instead of VISAOpen and enable the TermChar (default).

- Then get rid of BytesAtPort and read just 999 bytes - the TermChar will do the work fro you to read full messages!

- Don't use ExpresssVIs just to build a XY graph, a simple Bundle will do the same!

- Initialize shift registers!

- don't use InsertIntoArray when you want to build an array. Guess what BuildArray is for!?

- NEVER delete the label of frontpanel elements!

 

Suggestion:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(2,118 Views)
Solution
Accepted by Snyko

@GerdW wrote:

Suggestion:

 


Except I would use a complex array. Only one shift register and append needed, no need for the bundle, etc.

 

altenbach_0-1680477103266.png

 

Message 5 of 8
(2,085 Views)

The scan from string still doesn't work, I sent you the shown error. We don't know what you mean, we have to change in the arduino. It's the first time we use that program. Can you sent us an explanation for that?

Which propertys do we have to set on the Visa serial port?

Download All
0 Kudos
Message 6 of 8
(2,040 Views)
Solution
Accepted by Snyko

Hi Snyko,

 

when the VISA resource is valid, but not accessible, then you should close the other tool you currently use to access that port!

 

There can be only one (software) accessing this shared resource!

 


@Snyko wrote:

Which propertys do we have to set on the Visa serial port?


Read the help for this function, especially the paragraphs on the TermChar.

Then use it lwith default settings as they match the string sent from your Arduino…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(2,029 Views)

Thank you very much, it works!!

0 Kudos
Message 8 of 8
(2,003 Views)