Punov/Project/voltmeter.py

42 lines
1.2 KiB
Python
Raw Normal View History

class AKIP():
def __init__(self, device_ID):
self.ID = device_ID
self.folder = '/dev/usbtmc0'
print('init')
def getVoltageDC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:VOLT:DC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getCurrentDC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:AMP:DC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getVoltageAC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:VOLT:AC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)
def getCurrentAC(self):
self.instr = open(self.folder, 'w')
self.instr.write('MEAS:AMP:AC?\n')
self.instr.flush()
self.instr = open(self.folder, 'r')
data = self.instr.readline()
self.instr.close()
return float(data)