Trouble Accessing Thermocouple Data

Comments & issues
Post Reply
Michael
Phidgetsian
Posts: 6
Joined: Wed Jul 03, 2019 3:28 pm
Contact:

Trouble Accessing Thermocouple Data

Post 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
Attachments
Script
Script
Debugged
Debugged
fraser
Engineering
Posts: 325
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Trouble Accessing Thermocouple Data

Post 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()
Michael
Phidgetsian
Posts: 6
Joined: Wed Jul 03, 2019 3:28 pm
Contact:

Re: Trouble Accessing Thermocouple Data

Post by Michael »

That really helps a lot actually. Thank you very much Fraser. I applied those changes and now everything is working!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 19 guests