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: 

how to send the data from Labview to Arduino

Hard to debug.  You didn't attach any of your Arduino code to show how that is programed.

0 Kudos
Message 11 of 21
(2,286 Views)

This is my Arduino Code

#include <SoftwareSerial.h>
int incomingByte = 0; // for incoming serial data

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop()
{
if (Serial.available() > 0) //See if data is there
{
incomingByte = Serial.read(); //Read a byte
Serial.print("I received: ");
Serial.println(incomingByte); //println appends the termination character
}
}

0 Kudos
Message 12 of 21
(2,285 Views)

Remember that you can't have both LabVIEW and Arduino IDE open at the same time. 

Before you run your LabVIEW program, you need to close the Arduino IDE debug window. Only one of them can use the COM port at one time. 

0 Kudos
Message 13 of 21
(2,276 Views)

@kavyatweetee wrote:

Sir I modified my program in Arduino and also changed my VI but the output in Labview seems to be null. It is neither showing any output nor error in Labview.


I have to ask the stupid question: Did you press the Send button?  That Event Structure is sitting there waiting for you to do something.  One of the things it is waiting for is for you to press the Send button, which will make the LabVIEW code then write to the port and read the data back.  The other thing the Event Structure is waiting for is for you to press the Stop button, which will cause LabVIEW to close the serial port and end the VI by stopping the loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 21
(2,270 Views)

Good morning

Yes sir I did that and it is working but after pressing the stop button in Labview, I started seeing the output in Arduino but nothing comes to it.

It is also not showing that Arduino port busy and the output is also not coming in the "serial port". Can you please tell me why this happens with Arduino.

I used the same Arduino code which I given to you before in this discussion.

0 Kudos
Message 15 of 21
(2,252 Views)

@kavyatweetee wrote:

Yes sir I did that and it is working but after pressing the stop button in Labview, I started seeing the output in Arduino but nothing comes to it.


When you press the Stop button, the VI should have stopped running.  Therefore nothing should be being sent to the Arduino.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 21
(2,247 Views)

If you press send and the data gets sent to the Arduino through the VISA Write, the code will then wait at the VISA read until:

1.  It receives the termination character

2.  It receives the 50 bytes your requested

3.  It times out.  (usual default is 10 seconds)

 

So if you aren't getting data, you must be getting #3.  Are you getting time out errors?

0 Kudos
Message 17 of 21
(2,245 Views)

Good morning

 Firstly I want to tell the process that I am doing. I start with uploading my Arduino code to Arduino UNO Board and then I am opening my Labview code and I run that VI and I am getting the output in Labview(It is reading data from Arduino). Next I am opening the Arduino "Serial monitor" and it is showing the "PORT BUSY" error and I am not getting any time out errors also.

 

0 Kudos
Message 18 of 21
(2,228 Views)

You can't have two different programs accessing the same serial port.  Once one opens it, the other program is locked from using it.  That is what "PORT BUSY" means.

0 Kudos
Message 19 of 21
(2,224 Views)

Now what is the solution for this sir????

 

0 Kudos
Message 20 of 21
(2,221 Views)