08-06-2017 08:58 AM
Hello,
I want to add a start mark for the sensor signal. So I added a 'T' as the start mark. In my program, I will compare the string from the serial port with 'T' to judge, if the sensor data comes from the next measurement. But I have noticed, although the string from the serial port is 'T', the result of the comparison is 'false'. Could someone explain it?
Best regard
Solved! Go to Solution.
08-06-2017 09:46 AM
Can you save the serial output so we can see what you are comparing? You can also try right-clicking the string control and changing to '/' Codes Display to see if you are also picking up the termination character.
08-06-2017 11:33 AM
Hello Matt,
thanks for your replay. In this project, I will use LabVIEW to communicate with Arduino. The serial output from Serial Monitor and LabVIEW VISA is like:
T
1023
985
897
765
732
T
1024
988
898
765
732
...
It is like so, there is a 'T' as the start symbol for every five measurement data. In LabVIEW, I could read the start symbol "T" from the serial output of VISA, but when I compare this 'T' with another 'T', the result is false.
Best regard
08-06-2017 02:50 PM
You likely still have the Carriage Return and/or Line Feed in your read string. Try adding a Trim White Space before the comparison.
Another option would be to put all of your measurements into a single message. You can separate your measurements with a comma and end the message with the Carriage Return and Line Feed.
08-06-2017 03:35 PM
Hi,
thanks for your reply. Your idea sounds feasible, I will try it out.
Best regard