LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help on TCP connection ( LABVIEW AND ARDUINO YUN )

There's a response lag for the turning on and off of the light. For instance, when I on the light in labview, the actual lamp will only turn on awhile later. Could it be because the TCP is constantly listening and waiting for a client to connect after every loop?

Download All
0 Kudos
Message 1 of 2
(2,680 Views)

Can you post the sketch for the Yun?

 

The VI's loop isn't constantly listening and waiting for a client connection (that happens at the start outside the loop), but it is waiting to read 50 bytes (or 1000 bytes in the attached VI) of data from the TCP connection. Do you know how much data there is in a single response from the Yun? If it's less than 50 bytes, the TCP Read will wait until it has received exactly 50 bytes, and only then will the loop continue.

 

As a simple test try setting the TCP Read timeout to 10ms and see what happens. You'll probably get a bunch of read errors, but just see if the light is more responsive. If it is, then your TCP Read is slowing things down.

 

One way of ensuring the TCP Read reads the exact number of bytes is to send a header along with the TCP data. Have a look at the Simple TCP example LabVIEW project for details on adding and reading a header. It basically requires two TCP Reads, one to read the header, and then a second one to read the data.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 2 of 2
(2,604 Views)