Controlling relays using thermocouple readings

Supporting 2.7 and 3.2+
Post Reply
hlaps1990
Phidgetsian
Posts: 5
Joined: Sat Jun 04, 2016 1:17 pm
Contact:

Controlling relays using thermocouple readings

Post by hlaps1990 »

TLDR: What's the easiest way of interacting with a Phidget from inside another Phidget's event handler?

Me again, still working on the injection molding machine. The stepper motors are working great now thanks to the help I got on a previous post.

I want to regulate the temperature of the extruder using a thermocouple and four 40W cartridge heaters. I'm going to try to keep it simple for now: when the thermocouple notices a temperature change event, it checks to see if its below or above a global target temperature variable. From there, I'd like to be able to turn the heaters on or off, but I'm not sure how I can command the heaters in the temperature change handler because they were defined in a different scope. I'd prefer not to have to connect to the heaters every time I want to change them inside of the event handler. I have tried changing a global "is_heating" variable to "True", which works, but then I have to poll that value throughout the code to achieve any kind of update speed. Is there a more effective way of doing this?
jdecoux
Labview Developer
Posts: 180
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Controlling relays using thermocouple readings

Post by jdecoux »

In Python, you can add a Phidget handle to another Phidget by assigning it as an attribute.

For details and an example, you can look at our page on Referencing Other Phidgets from Events.
hlaps1990
Phidgetsian
Posts: 5
Joined: Sat Jun 04, 2016 1:17 pm
Contact:

Re: Controlling relays using thermocouple readings

Post by hlaps1990 »

Awesome, that worked, thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests