From 1d73cd6f68aaf4d4a6a4ea5fd539e28e10adbafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9F=D1=83?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= Date: Mon, 5 Dec 2022 12:27:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20'Pro?= =?UTF-8?q?ject'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/power_unit.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Project/power_unit.py diff --git a/Project/power_unit.py b/Project/power_unit.py new file mode 100644 index 0000000..1d46452 --- /dev/null +++ b/Project/power_unit.py @@ -0,0 +1,19 @@ +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())