Punov/Project/program_files/ammeter.py

28 lines
807 B
Python

import serial
class B7_78():
def __init__(self, folder):
self.folder = folder
self.instr = serial.Serial(
self.folder, timeout=1, inter_byte_timeout=1)
self.instr.write(b'SYST:REM\n')
self.instr.write(b'SYST:REM\n')
def getCurrentDC(self):
self.instr.write(b'MEAS:CURR:DC?\n')
return float(self.instr.read(100).decode().rstrip())
def getVoltageDC(self):
self.instr.write(b'MEAS:VOLT:DC?\n')
return float(self.instr.read(100).decode().rstrip())
def getCurrentAC(self):
self.instr.write(b'MEAS:CURR:AC?\n')
return float(self.instr.read(100).decode().rstrip())
def getVoltageAC(self):
self.instr.write(b'MEAS:VOLT:AC?\n')
return float(self.instr.read(100).decode().rstrip())