Commit 5c044d95 authored by Alén Arias Vázquez's avatar Alén Arias Vázquez 😎

- change default value of tty \ - change the prints \ - add function to read parameters

parent 6e7d6584
......@@ -5,7 +5,7 @@ import argparse
class CPX400DP(object):
def __init__(self, name='CPX400DP', devname='/dev/tty_CPX', baudrate=115200, log_level=logging.INFO):
def __init__(self, name='CPX400DP', devname='/dev/ttyACM0', baudrate=115200, log_level=logging.INFO):
logging.basicConfig(format='%(asctime)s.%(msecs)03d %(name)s-%(levelname)-s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=log_level) = name
self.log = logging.getLogger(
......@@ -34,7 +34,7 @@ class CPX400DP(object):
answer=self.recv_cmd()"Channel {} ---- {}}V".format(chan,float(answer[:-3])))"Voltage channel {}: {}V".format(chan,float(answer[:-3])))
return float(answer[:-3])
def set_current(self, amps, chan=1):
......@@ -46,7 +46,7 @@ class CPX400DP(object):
answer=self.recv_cmd()"Channel {} ---- {}A".format(chan,float(answer[:-3])))"Current channel {}: {}A".format(chan,float(answer[:-3])))
return float(answer[:-3])
def unlock(self):
......@@ -72,8 +72,17 @@ class CPX400DP(object):
self.set_current(amps=amps, chan=chan)
def get_values(self, chan=1, volts=10.0, amps=0.3):
for i in range()
def get_parameters_chan(self, chan=1):
V = self.get_voltage(chan=chan)
I = self.get_current(chan=chan)
return V, I
def get_parameters(self):
V1, I1 = self.get_parameters_chan(chan=1)
V2, I2 = self.get_parameters_chan(chan=2)
return V1, V2, I1, I2, P1, P2
def main():
parser = argparse.ArgumentParser(description='Control CPX400DP from USB', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment