Showing results for 
Search instead for 
Did you mean: 

Arduino won't accept my string from Labview

Go to solution

Please tell me what I'm doing wrong.  I am just trying to send a simple string to the Arduino in this case "1,1,1" which tells the Arduino to turn on pin 13 for 5 seconds.  If I send the string via Serial Monitor on the Arduino IDE it works fine, but if I send it through labview it won't perform said action I want.  I apologize if this is similar to another forum post, but I've looked through what seems like thousands of posts and cannot get this to work with any of the solutions.  Thank you in advance.  Here is my block diagram and code:



int led = 13;
char val;
String value;


void setup() {


void loop() {

if (Serial.available()>0){
value = "";
while (Serial.available()>0){
val = (char);
value += val;
if(value == "1,1,1"){
digitalWrite(led, HIGH);
digitalWrite(led, LOW);
else {
digitalWrite(led, LOW);

0 Kudos
Message 1 of 6

I suspect you are missing the carriage return/line feed at the end of your command. At a minimum you should terminate any strings you are sending with a Line Feed character.

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 6

You might want to add a delay after the VISA Write.  I suspect you are closing the port before the hardware has had a chance to send all of the data.


Also, you do not need the VISA Open.

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 3 of 6

Hey guys,  I tried both of your suggestions and still nothing.  All that that happens is RX blinks once and pin 13 blinks repeatedly for a couple of seconds, waits a second and then blinks once, like it's receiving information (even though it's not the RX pin) and that's it.  When I send it through the Serial monitor RX blinks once and pin 13 goes high immediately for 5 seconds and turns off as intended (Just as an aside, I have no termination character set on the Serial monitor).  I just tried a different board and it's the same behavior.  If anyone can try this on their end and get it to work, I would appreciate it very much.  Thanks.




0 Kudos
Message 4 of 6

Also, another piece of information is that it exhibits the same behavior with RX blinking once and pin 13 blinking repeatedly, pausing for a second, and then blinking once more when I open the Serial Monitor on the Arduino IDE.  It might be relevant to the issue.

0 Kudos
Message 5 of 6
Accepted by topic author abstrak

That last tidbit was the problem.  I added a two second delay after the serial port configuration vi and it worked as intended.




0 Kudos
Message 6 of 6