01-29-2018 09:21 AM
I am working on a project which takes dht11 sensor values from Arduino and transfers it to LabVIEW through visa.The whole idea is to collect real-time data i.e values of temperature and humidity from the sensor and save it in a .csv file.I created a sub VI for data transmission.The problem is the text file shows only 9 values but not continuous values.
Solved! Go to Solution.
01-29-2018 09:36 AM
Does the vi stop, or does it continue to run? I'm betting on the latter. It looks as if there might be some sort of buffer overrun.
Providing the vi rather than attached pictures may help isolate your issue.
01-29-2018 09:44 AM
Why are you using Data Bits to tell the VISA Read how many bytes to read? That makes 0 sense.
What exactly does the data coming from the Arduino look like? Are you using the PrintLn? If so, then tell the VISA Read to read more bytes than you ever expect and the termination character will stop the read process. This is how you can know that you got your full message.
Your exact issue seems to be coming from your logging VI. You are opening the file each time and overwrite data that was already there. I highly suggest you create or replace the file before your loop and do not close it until after the loop. This way you will continuously be adding to the file instead of overwriting data and the file IO will be faster.
Other notes:
You might also want to learn to use the Scan From String. It can eliminate all of your parsing code.
Likewise, learn to use Format Into String. It simplifies your building of the string for logging.
No need for the wait in that case structure. The VISA Read will limit your loop rate.