Page 1 of 1

Trouble Accessing Thermocouple Data

Posted: Fri Jul 05, 2019 2:56 pm
by Michael
Hey everyone,

I'm having some trouble accessing the Thermocouple Data from my phidget device and I'm getting some weird results when I try compiling that make me think perhaps my channels aren't actually attaching.

Also, when I set the IsHubPortDevice command to "True", I get an error saying "IsHubPortDevice" cannot be set to true for this channel class. Any idea why I can't or shouldn't set it to true? I've just removed this command and I don't get anymore errors like that (most likely because it is probably now automatically being set to "False").

I've attached some screenshots to show what happens when I try to compile with how my code is right now.

Any advice is greatly appreciated!

Thank you,
Michael

Re: Trouble Accessing Thermocouple Data

Posted: Mon Jul 08, 2019 12:15 pm
by fraser
The reason you cannot set the IsHubPortDevice is because that is restricted to channels on the VINTHub itself, ie its internal Voltage/Digital Inputs. Setting the correct HubPort is enough.

Couple other things from your code.
1) You can set the onAttachHandler before opening the device, that way it will fire when it actually attaches from the Open call. But generally we don't use both openWaitForAttachment AND attach handlers. So in this case the handler is unnecessary. The openWaitForAttachment call will fail if the device is not attached.

2) The reason you get that weird message as your temperature is because you are printing out the Temperature object itself, rather than the Temperature associated with the object. Fix this by getting the temperature form the object then printing it out using

ch.getTemperature()

Re: Trouble Accessing Thermocouple Data

Posted: Tue Jul 09, 2019 7:24 am
by Michael
That really helps a lot actually. Thank you very much Fraser. I applied those changes and now everything is working!