LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Help reading a INT value in LabView (Solved)

Hi!

I am currently working on a proyect with a Ping))) Sensor, an arduino Duemilanove and LabView 2011, what I am trying to do is be able to show the measurement from Ping))) sensor in Labview.

Right now I am working with Lifa Base file mixed with Ping))) file from Arduino Examples and it working as I am able to read the distance trought Serial Monitor.

In the labview side I am using the Arduino Read Analog Pin Examples that came with it, but it is not working becaus the Ping))) data is stored in an INT value.

So my question is, there is any way to read and INT value from Arduino in Labview, there is an other option?

Thanks in advance

Ps> I will attach the files with I am currently working with.

Download All
0 Kudos
Message 1 of 19
(6,834 Views)

Because of the way that LIFA is constructed, you cannot print to serial outside of the LIFA command structure like you do.  To implement the PING))) sensor, you must add a custom command to LIFA, both in the firmware (LabVIEWInterface.ino) and in LabVIEW.  The command in the firmware would do the digital writes and the pulseIn function.  It would then print the raw data back to LabVIEW and do the required conversions there.

The best advice I can give for doing this is to first duplicate an existing simple function (new entry in the command list of the firmware and a new VI of a different name) like digital or analog read and make sue that it works exactly like the function used to base it on.  Then, when that is working, you can change the code to implement the digital writes and pulseIn commands accordingly.

If you have issues doing this, post your LIFAInteface.ino that you modified along with your newly created VI and we can help you out.

Message 2 of 19
(3,774 Views)

Nathan Thanks for your fast answer.

As I am really new in this I must ask:

The idea is to make the labview to send the signals and receive the signals that the Ping))) need trough arduino and make all the calculus back in the labview enviroment?

When you say that I have to add a custom command in labview you mean in the back panel right?

Thanks again for the answer

0 Kudos
Message 3 of 19
(3,775 Views)

Here is the firmware with the added LIFA function along with the corresponding VI for getting the distance from the sensor.

First, upload this firmware to your Arduino and then you can use the VI in your program to get the distance.  Let me know if it works for you.

EDIT:  The files are now in a document here.

Message 4 of 19
(3,775 Views)

Nathan

Thanks again

I have tested both files that you upload but in both of them I am having the same mistake:

Error out:

Code: 5003

A time out occuredwhile trying to read form the Arduino.

I have choosen the settings as it follows:

Visa resoruce: COM 3 (That is the COM that my arduino is connecting to)

Board type: Dimuela with ATmega 328

Connection Type

USB/Serial

Bytes per packet (15): 15

Pin: 7 (I also try with 5 that is an analog Pin to see if that makes a difference but it dosn't)

Error in have a green check and no errors

What could be possibly wrong?

0 Kudos
Message 5 of 19
(3,775 Views)

I have been trying to fin the error by miself but I can tell you this:

Check for pin out of range when I use it by its own dosn't send any error code

Send Receive neither in fact it says:

Status : Green check

Code: 1073676294

Source: LabVIEW Interface for Arduino.lvlib:Send Receive.vi

Every time that I click on run on this VI a red led in the arduino board blink so I think that I actually have communication with the board.

The ping sensor have a led that blink when is working some digital pins (6,5,4,3,1 and 0) when I connect the ping sensor to them the led gets on but steady not blinking, pings 7 and 2 dosn't do that.

The ping and arduino are working fine when I upload arduino Ping sensor example.

0 Kudos
Message 6 of 19
(3,775 Views)

The 5003 error makes me think that the custom firmware that I created was not uploaded.  Can you confirm that you uploaded the firmware that I posted?

If you are absolutely sure that it got uploaded successfully, I would suggest that you find the particular VI that is creating the 5003 error.

Message 7 of 19
(3,775 Views)

I recorded a video showing step by step what I am doing, right now I am uploading it Youtube, but in the Send Recive I got this mistake (dosn't happen before)

Code:-1073807194

Source:

VISA Read in LabVIEW Interface for Arduino.lvlib:Send Receive.vi

Nothings appear after I search about it 😕

Ok this is the video link http://youtu.be/vpyiqGmmPkY

0 Kudos
Message 8 of 19
(3,775 Views)

So I was able to get an arduino UNO an I got the same mistakes so is not my board....

I am really stuck here please please help

0 Kudos
Message 9 of 19
(3,775 Views)

Ok, I know the problem.  So, the VI that I created is not a "working example" in itself.  It is a subVI for you to use in another VI (similar to "Digital Read Pin") that you are using to communicatate with the Arduino.  See the attached VI for how to use it.

Message 10 of 19
(3,775 Views)