Silaev/3.5.1 auto/voltmeter.py

44 lines
1.2 KiB
Python
Raw Normal View History

class AKIP():
def __init__(self, folder):
self.folder = folder
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)
# for i in range(5):
# print(AKIP('/dev/usbtmc0').getVoltageDC())