InStr & Mid$
-
hi, i have these code with temperature="TEMP(C) 37.0:\r\n" X = InStr(1, temperature, ")") temperature = Mid$(temperature, X + 2, 4) After the code is excuted , will i have temperature = 37.0 Cause i execute and the value of temperature is not stable ? Thanks
-
hi, i have these code with temperature="TEMP(C) 37.0:\r\n" X = InStr(1, temperature, ")") temperature = Mid$(temperature, X + 2, 4) After the code is excuted , will i have temperature = 37.0 Cause i execute and the value of temperature is not stable ? Thanks
-
Hi, Your code will extract the substring from the position given. What do you mean by the value of temperature is not stable? Alan.
-
Actually my code is used to get the temperature of the devices . Normally the values in the range 35-39 . But sometimes i got 6 or 7... which are surely wrong ? Thanks
Well that would tend to indicate that the device is returning the wrong information. Log all data to a text file and then take a look at the file to see if there is any pattern to the bad values. Your options are to fix the device, or if that is not possible to write code to ignore the bad values. Until you know a lot more about the data that is coming from the device you can't begin to parse it reliably. Alan.