LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Write Arduino Problem

Labview VISo just a little background of what Im trying to do: Make a labview to send a character over to the arduino and the arduino reads that in and then writes to its EEPROM a value if it recieved something. Basically i wrote a simple program to test this out although it only works when I have the debugger active. First I thought this may be a timing issue so I added in a wait paramter but still no luck. Any one know what the solution to getting the program to work using the regluar run  command?

(Also the serial Port does open when in the debugger I know)VI Serial

Arduino Code:

String x="";
#include <EEPROM.h>
void setup() {
  // initialize serial:
  Serial.begin(9600);
  // make the pins outputs:
 
}

void loop() {
  // if there's any serial available, read it:
  if(Serial.available() > 0) {
   EEPROM.write(1,3);
  }

}

 

 

0 Kudos
Message 1 of 8
(4,457 Views)
I have no idea about the arduino code but your block diagram shows that you don't have a VISA Resource Name. It has to be on the block diagram. Opening the function and entering it there does no good.
0 Kudos
Message 2 of 8
(4,447 Views)

No thought to using LIFA or LINX?

0 Kudos
Message 3 of 8
(4,434 Views)

If you have done a little work and read some of the other threads about Arduino and serial problems, then you would have seen that you need a delay inbetween configuring the serial port and writing to the serial port in your LabVIEW program.

The delay should be around 1.5 sec, but true to increase the value to 2 sec. if it does not work.

 

Second, the Arduino code shown does not read the value in the serial buffer, it only check if there is values in the buffer. Once a value is sent to the Arduino, it will stay in the buffer all the time. You need to read the value or clear the buffer, so that the function Serial.available() does not return true all the time.

 

0 Kudos
Message 4 of 8
(4,388 Views)

@dkfire wrote:

If you have done a little work and read some of the other threads about Arduino and serial problems, then you would have seen that you need a delay inbetween configuring the serial port and writing to the serial port in your LabVIEW program.

The delay should be around 1.5 sec, but true to increase the value to 2 sec. if it does not work.

 

Second, the Arduino code shown does not read the value in the serial buffer, it only check if there is values in the buffer. Once a value is sent to the Arduino, it will stay in the buffer all the time. You need to read the value or clear the buffer, so that the function Serial.available() does not return true all the time.

 


--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 8
(4,362 Views)

@dkfire wrote:

If you have done a little work and read some of the other threads about Arduino and serial problems, then you would have seen that you need a delay inbetween configuring the serial port and writing to the serial port in your LabVIEW program.

The delay should be around 1.5 sec, but true to increase the value to 2 sec. if it does not work.

 

Second, the Arduino code shown does not read the value in the serial buffer, it only check if there is values in the buffer. Once a value is sent to the Arduino, it will stay in the buffer all the time. You need to read the value or clear the buffer, so that the function Serial.available() does not return true all the time.

 


--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 6 of 8
(4,355 Views)

@dkfire wrote:

If you have done a little work and read some of the other threads about Arduino and serial problems, then you would have seen that you need a delay inbetween configuring the serial port and writing to the serial port in your LabVIEW program.

The delay should be around 1.5 sec, but true to increase the value to 2 sec. if it does not work.

 

Second, the Arduino code shown does not read the value in the serial buffer, it only check if there is values in the buffer. Once a value is sent to the Arduino, it will stay in the buffer all the time. You need to read the value or clear the buffer, so that the function Serial.available() does not return true all the time.

 


--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 8
(4,346 Views)

Did you have anything to say Ranjeet_Singh?

0 Kudos
Message 8 of 8
(4,319 Views)