PS_Control/LV_Powersupply/Lv_PS_Control.py

37 lines
755 B
Python

import spd3303x
import time
ps_ip = "192.168.178.4"
# Create an instance of the EthernetDevice class
dev = spd3303x.EthernetDevice(ps_ip)
# Connect to the power supply
dev.connect()
# Control Channel 1
dev.CH1.set_voltage(8)
dev.CH1.set_current(0.75)
dev.CH1.set_output(True)
print(dev.CH1.get_current())
print(dev.CH1.get_voltage())
print(dev.CH1.measure_voltage())
print(dev.CH1.measure_current())
# Control Channel 2
dev.CH2.set_voltage(8)
dev.CH2.set_current(0.75)
dev.CH2.set_output(True)
print(dev.CH2.get_current())
print(dev.CH2.get_voltage())
print(dev.CH2.measure_voltage())
print(dev.CH2.measure_current())
#Turn off
dev.CH1.set_output(False)
time.sleep(0.2)
dev.CH2.set_output(False)
# Disconnect from the power supply
dev.disconnect()