LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to serial write to arduino

Solved!
Go to solution

Hi guys, I am developing a project which need Labview to interface with Arduino Uno, but no matter how I modify the connection, my serial write keep malfunctioning, when I click the button 'Home', the Rx led on the Arduino is blinking which indicates it received something, but my hardware got no action at all, so guys please help me check whether my connection on the write palette is correct or not. Thanks in advance!!!

0 Kudos
Message 1 of 5
(3,251 Views)

Are your settings such as baud rate, data bits, stop bits, parity bits correct?

 

I bet the problem is on the Arduino side.  Without attaching that, it is going to be hard for anyone to help you.

 

Some things I do see is that you are configuring the VISA port and closing it on every iteration of the while loop.  Those things belong outside.  You should only read and write to the serial port on every iteration.

0 Kudos
Message 2 of 5
(3,226 Views)
Solution
Accepted by topic author V_F

They are not your problem, but some general notes:

1. The outter loop and case structure are pointless.  Just remove them.  When you run your VI, you will be connected.  This will make things easier to see (less noise).

2. Almost all code I have seen with an Arduino uses the PrintLn function, which adds a termination character (line feed) to the serial message.  I highly recommend you use this, turn on the usage of the termination character in you LabVIEW code, and then get rid of the Bytes At Port.  Just tell the VISA Reads to read more bytes than the longest message from your Arduino.  The reads will stop when they find the Line Feed character.

3. Possibly your problem: does the Arduino expect to see a Line Feed at the end of the string it is recieving?


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 3 of 5
(3,225 Views)

Thanks 

0 Kudos
Message 4 of 5
(3,202 Views)

But may I know why does this happen? Why I cannot put a case structure to the write palatte?

0 Kudos
Message 5 of 5
(3,189 Views)