You can download this code by clicking the button below.
This code is now available for download.
This function uses the PyVISA library to connect to a device at a specified address and read its current values.
Technology Stack : PyVISA
Code Type : Function
Code Difficulty : Intermediate
def read_values_from_device(device_address):
import visa
rm = visa.ResourceManager()
try:
device = rm.open_resource(device_address)
device.read_terminals()
values = device.query("READ?") # Query the device for its current values
return values
finally:
device.close()
rm.close()