From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-27-2019 10:50 AM
I have two thermometers, A and B, attached to my arduino uno and I need to read the current temperature from both of them. Initially I had them writing constantly but it became difficult to know for sure which I was reading from. Additionally, I occasionally encountered wildly inaccurate data due to race conditions. I tried to solve both of these problems by placing the serial print statements behind if statements.
command = (byte)Serial.read();
if(command == 'S') Serial.println(Ta); //return A temp
if(command == 'O') Serial.println(Tb); //return B temp
This works fine in the serial monitor but I can't seem to write to it from LabView. When I try to read from the arduino after writing either "S" or "O", labview errors out saying that "timeout expired before operation completed". I'm really not sure what I'm missing here but I'm sure I've overlooked something simple. Any insight on the matter would be appreciated. Thanks for your time.
Solved! Go to Solution.
06-27-2019 11:01 AM
Please attach a VI using Save for Previous Version back to LV 18 or older.
LV 2019 just came out a month ago. Not everyone is using it yet!
06-27-2019 11:13 AM - edited 06-27-2019 11:18 AM
Thanks for the quick response, here's the 2018 version.
(Edit: Just in case I've still not given you the right version I'll attach an image)
06-27-2019 12:30 PM - edited 06-27-2019 12:42 PM
No error cluster? I haven't ever met a programmer so good they don't need to wire up the error clusters...
Anyway you are doing it wrong. Search the board for "Bytes at Port" (but don't use bytes at port) and you will find several serial examples that show the right way to do serial communications.
But do you really need to query the Arduino for the values?
06-27-2019 01:00 PM
Separating the values with a comma works beautifully. Thank you!
06-27-2019 01:13 PM
I would have done something like this:
This was for receiving three values (g,h,j) from an Arduino separated by commas.
06-28-2019 06:36 AM
@RTSLVU wrote:
I would have done something like this:
This was for receiving three values (g,h,j) from an Arduino separated by commas.
Spreadsheet String To Array would be the route I would go. It would allow for any number of parameters.
06-28-2019 09:37 AM
That also works quite nicely, thank you.