-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagheater.py
More file actions
29 lines (22 loc) · 947 Bytes
/
magheater.py
File metadata and controls
29 lines (22 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
""" a driver to control the on/off functions of the magnet heater """
import serial
class Heater():
""" a class for controling the Lakeshore 370 resistance bridge """
def __init__(self, com):
""" open port and set default state """
try:
self.ctrl = serial.Serial(com, 9600, timeout=1)
except:
raise IOError("Could not connect to serial port: {0}".format(com))
self.ctrl.setDTR(True) # make sure the heater is off when this script is started
# should be true as soon as the port is initialized
# this is redundant
def close(self):
""" closes the VISA instance """
self.ctrl.close()
def relay_on(self):
""" turns the relay on """
self.ctrl.setDTR(False)
def relay_off(self):
""" turns the relay on """
self.ctrl.setDTR(True)