Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python Doc and Py Project #56

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,22 @@
from instrcomms import Communications

INST_RESOURCE_STR = (
"USB0::0x05E6::0x6500::04429419::INSTR" # Get from VISA Interactive Control
"USB0::0x05E6::0x6500::04429707::INSTR" # Get from VISA Interactive Control
)
start_time = time.time() # Record start time

# ================================================================================
#
# MAIN CODE STARTS HERE
#
# ================================================================================
def main():
"Main code. Will print instrument IDN 10 times and print elapsed time taken to do so."
start_time = time.time() # Record start time
my_instr = Communications(INST_RESOURCE_STR)
my_instr.connect()

my_instr = Communications(INST_RESOURCE_STR)
my_instr.connect()
my_instr.write("*RST")
for _ in range(10):
my_instr.write("*IDN?")
print(my_instr.read())
print(my_instr.query("*IDN?")) # query is the same as write + read

my_instr.write("*RST")
for _ in range(10):
my_instr.write("*IDN?")
print(my_instr.read())
print(my_instr.query("*IDN?")) # query is the same as write + read
my_instr.disconnect()
stop_time = time.time() # Record stop time
# Notify the user of completion and the data streaming rate achieved.
print("done")
print(f"Elapsed Time: {(stop_time-start_time):0.3f}s")

my_instr.disconnect()

stop_time = time.time() # Record stop time

# Notify the user of completion and the data streaming rate achieved.
print("done")
print(f"Elapsed Time: {(stop_time-start_time):0.3f}s")


if __name__ == "__main__":
main()