Skip to content

Commit

Permalink
simplified the example's readings acquisition
Browse files Browse the repository at this point in the history
  • Loading branch information
attie committed Dec 4, 2019
1 parent 7e5f5b8 commit b947663
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
try:
# log power usage at ~1Hz
while True:
v = psu.get_output_voltage().value
i = psu.get_output_current().value
p = psu.get_output_power().value
print('%2.2fv %1.3fA %2.2fW' % ( v, i, p ))
i, v, p = psu.get_output_readings()
print('%2.2fv %1.3fA %2.2fW' % ( v.value, i.value, p.value ))

if not psu.get_output_state():
# if the output is no longer enabled, then exit
Expand Down
6 changes: 2 additions & 4 deletions example_ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ def get_next_voltage(v_live):
try:
# log power usage at ~1Hz
while True:
v = psu.get_output_voltage().value
i = psu.get_output_current().value
p = psu.get_output_power().value
print('%2.2fv %1.3fA %2.2fW' % ( v, i, p ))
i, v, p = psu.get_output_readings()
print('%2.2fv %1.3fA %2.2fW' % ( v.value, i.value, p.value ))

if not psu.get_output_state():
# if the output is no longer enabled, then exit
Expand Down

0 comments on commit b947663

Please sign in to comment.