I'm trying to read sensor's value obtained from arduino and displaying it on labview using a pulse sensor and a DS18B20 (temperature sensor) however I need the while loop to go fast (around 50 ms) in order to get the waveform chart from the heart pulses but if it goes slower than a minute the values get mixed up (I get temperature instead of the analog sensor value and viceversa) any suggestions to fix this? I obtain the values in a serial.print separated by a comma, so I used a match pattern on LV to separate them
相关问题
- Android app not synchronized with Arduino Serial c
- Serial Communication between Arduino and Python, i
- SIM900 GSM/GPRS not getting a proper AT+CREG? answ
- How to make Arduino run a script
- Volatile variable in class: “expected unqualified-
相关文章
- Arduino not able to send serial data back
- C# - Finding Peaks within a Given Width via Quadra
- XTEA encryption in PHP and decryption in C
- Terminating a voice call via AT Command
- Reading a Serial Port - Ignore portion of data wri
- How to get millisecond resolution from DS3231 RTC
- Arduino (processing) Library in Netbeans and contr
- Arduino Ethernet Shield Not Connecting to WebServe
If you check how many bytes are waiting at the port and only read that number of bytes, you are likely to get incomplete messages. It's hard to say exactly how this is going wrong without seeing an example of the data and the line(s) of Arduino code that send it, but in general to get this sort of data exchange to work well I would suggest you:
0x0A
) after each pair of valuesBytes at Port
, but wire a large value tobytes to read
of the Serial Read function. The Serial Read will read and return bytes from the serial buffer up to and including the termination character, waiting for them to arrive if necessary (up to the timeout setting configured for the port). That way you should always receive a complete string.To get data out of the received string I would use the
Scan from String
function. For your example it looks as if the appropriate scan string would be something like%f,%f\n
which specifies two floating-point values separated by a comma and terminated with a newline. Scan from String has an error output and also allows you to wire in defaults for each value you are trying to read, so you can detect if the data hasn't been received correctly.The best way to show LabVIEW code here, rather than taking a screenshot, is to select it on the diagram and choose
Edit
>Create VI Snippet from Selection
. This saves a PNG image that also has the actual LabVIEW code embedded in it. Also please consider arranging your block diagram so the data flow is from left to right as far as possible as this convention makes it much easier to read.