Punov/Project/program_files/power_unit.py

20 lines
522 B
Python

import check_connection
import serial
class Agilent():
def __init__(self, folder):
self.folder = folder
self.instr = serial.Serial(
self.folder, timeout=1, inter_byte_timeout=1)
msg = 'OUTput on\n'
self.instr.write(msg.encode('ascii'))
def setVoltageDC(self, volt):
self.instr.write(('VOLTage '+str(volt)+'\n').encode('ascii'))
def getID(self):
self.instr.write(('*IDN?\n').encode('ascii'))
print(self.instr.read(100).decode().rstrip())