bancada-motores/PZ4000/Programas/serial.py
Pedro Jose Romero Gombau 3d8f36d8e0 Diseño 3D
2025-05-22 14:56:46 +02:00

20 lines
620 B
Python

import pyvisa
# Initialize the visa resource manager
rm = pyvisa.ResourceManager('C:\\Windows\\System32\\visa64.dll')
# Replace 'GPIB0::X::INSTR' with ypython -m visa infoour actual GPIB address
# This address is typically something like 'GPIB0::5::INSTR'
# You can use rm.list_resources() to find it.
instrument = rm.open_resource('GPIB0::1::INSTR') # replace with the actual address
# Send an identification query to the instrument
instrument.write('*IDN?')
response = instrument.read().strip()
# Print the response from the instrument
print("Instrument ID:", response)
# Close the connection
instrument.close()