Skip to content

Commit

Permalink
Fixed some sample code for Power Supply
Browse files Browse the repository at this point in the history
  • Loading branch information
DJ90864 committed Sep 10, 2024
1 parent 8457c01 commit 9341c11
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions validationtools/validationtools/powerSupply/_powerSupply.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,18 @@ def get_id(self) -> str:
returns: string, device identification
"""
return self.ps.query('*IDN?')

# Example usage
if __name__ == "__main__":
power_supply = PowerSupply()
print(power_supply.get_id())
# power_supply.set_voltage(5.0) # Set voltage to 5V
power_supply.set_current(1.51, 2)
power_supply.enable_output(2)

time.sleep(5)

current = power_supply.measure_current(2)
voltage = power_supply.measure_voltage(2)
print(f"Voltage: {voltage} V, Current: {current} A")
power_supply.disable_output()

0 comments on commit 9341c11

Please sign in to comment.