05-14-2024 10:24 AM
Hello,
i want to read the data from Arduino serial port and save them in an Excel file. The Arduino is combined with a temperature sensor and sends data to the serial port. I followed the tutorial of link: Read Arduino Card Serial Port Data Using LabVIEW (youtube.com)
However when i check the txt file, i'm getting these weird data. It repeats the count from 0 on to actualize the new data. I just need sheet from 0 to the new data point directly.
I've tried with the suggestion to put the Write To Measurement function outside of loop. But by doing so, even no files can be generated.
Could anyone help me to solve the problem?
My vi can be found in attachment.
Solved! Go to Solution.
05-14-2024 01:47 PM
Could you share your Arduino code as well? I just want to make sure what your messaging protocol actually is before giving any real advice, which would currently be based on a wild guess.
05-14-2024 02:23 PM
Hello,
thanks for your reply. Below is my Arduino sketch.
05-14-2024 03:13 PM
With the feedback node, you are appending one element and then write that array to the file. You actually wanted to do this:
It should have worked when you put write to measurement file after the loop, but only after stopping the loop.
Write to measurement file is really slow. You could also write to a comma-separated text file. You can open it with excel:
05-15-2024 10:28 AM - edited 05-15-2024 10:29 AM
Here's what I would do.
First, get away from the Write Measurement File function. Instead, create/replace a file before the loop, close it after the loop, and you can write whatever you want inside of the loop. In this case, you can just take the string that was just read from the Arduino straight into the Write Text File.
Secondly, get rid of the array and instead use a Chart. The chart has a built-in history, so you don't even need the Feedback Node anymore.