I need to make a serial communication between my Arduino Uno and LabVIEW application running on my PC. The Arduino and PC are connected through USB cable.
Attached please find the Arduino sketch and the LabVIEW code (I changed the extension to “.ino” to be able to attach it. So please change it back to “.vi” to be able to open it in LabVIEW).
The arduino prints numbers from 0 to 9 to serial buffer, and stops the printing.
The LabVIEW application reads the data from the buffer and closes the connection session.
I run the Arduino sketch. It writes the numbers to the buffer.
Then I run the LabVIEW application. It successfully reads the numbers and closes the session.
When I run the LabVIEW app again (note that the arduino already stopped printing the numbers) it reads the numbers again. This process continues whenever I run the LabVIEW app.
The only way to fix this, I thought to clear the buffer content in LabVIEW app (before closing the session). However, it didn’t help.
Then I tried to clear the buffer in Arduino as well, however it didn’t help as well.
Can anyone tell me what am I doing wrong, or is there any other way to clear the serial buffer not to read the same data the second time?
Thanks in advance,
sketch_jun05a.ino (254 Bytes)
main.ino (16.5 KB)