METHOD 2: BYTE ARRAY
The approach described before is not that flexible as it assumes a fixed number of bytes is exchanged. Moreover data were sent encoded in ASCII and not as C data type implementation.
A more versatile approch would be send data to LabVIEW as sequence of bytes (binary). This would allow to send variable length data and reconstruct them inside LabVIEW, and require proper serialization functions in the firmware.
The following example show how to read a single precision float (4 bytes). A fifth byte is prepended and used as header for the transmitted data. LabVIEW wait for 5 bytes on the serial line, read the first of them and if it’s not equal to 0×69 flush the serial receive buffer and wait for the next packet. If the header is recognized the remaining 4 bytes are swapped to convert Arduino’s little-endian to LabVIEW big-endian format, then casted to a single precision float.