11-08-2018 02:35 AM
@RavensFan wrote:
Interesting.
Then how do you print a literal backslash and "t"?
Why would this behave differently than other text based languages?
Isn't it quite common to interpret \t as tab, and \\ for Writing a backslash? C# uses it that way.
/Y
11-08-2018 07:39 AM
@jmed87 wrote:
I was able to change the code to read by tab but I'm not really sure where to go from there when you say to read all of the sensor data and put it in variables or how to put it into code exactly?
Ok, let's simplify things some. Get rid of the printTemperature function entirely. Then change your loop routine to be like below. This will create a line of tab delimited values that your LabVIEW code can very easily read. Do note that sensor 5 is using the Serial.PrintLn. This appends the termination character for you. You then use Spreadsheet String To Array to turn the read string into an array of temperatures in C. You can convert to F from here if you really want to.
void loop(void) { delay(2000); sensors.requestTemperatures(); Serial.print(sensors.getTempC(Sensor01)); Serial.print("\t"); Serial.print(sensors.getTempC(Sensor02)); Serial.print("\t"); Serial.print(sensors.getTempC(Sensor03)); Serial.print("\t"); Serial.print(sensors.getTempC(Sensor04)); Serial.print("\t"); Serial.println(sensors.getTempC(Sensor05)); }
So to put all of this another way, your format of the data over the serial port is way too complicated. The serial data should just have the values and no fluff. Any error checks and unit conversions can easily be done by the LabVIEW code on the PC before displaying the data.
11-08-2018 08:02 AM
Thank you so much crossrulz for being patient with me and taking your time to explain and help with the code. Really means a lot since I am trying to learn a variety of new things at once on my research team (not just programming but bacterial fermentation as well). It all makes sense now.
Thanks again,
Josh
11-12-2018 07:26 AM
I was on Vacation last week, but I'm back now. I created a text file by typing in the values from your screen shot and read that file in and I think this would be a good example for you to learn from.
11-12-2018 07:28 AM
Converted to LabVIEW 2010.