Код: Выделить всё
import pyvisa
class LcrDevice:
def __init__(self, port="4"):
self._name = self.open_lcr_connection(port)
def open_lcr_connection(self, port):
# Return a tuple of all connected devices matching query.
try:
pyvisa.ResourceManager().close()
# Create a new resource manager tied to the specified VISA library.
rm = pyvisa.ResourceManager()
# device_list = rm.list_resources()
# print(device_list)
device = rm.open_resource(f'ASRL{port}::INSTR')
print(device.query_ascii_values('FETCH:MAIN?'))
return device
except Exception as e:
print("Falha ao carregar o dispositivo: ", e)
@property
def name(self):
return self._name
Код: Выделить всё
* Serving Flask app 'main'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://10.121.162.141:8000
Press CTRL+C to quit
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /views/lcr-meter HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/js/assets/js/bootstrap.bundle.min.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/css/main-style.css HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/js/assets/js/socket.io.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/js/assets/js/wrapper.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/js/index.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:40] "GET /static/js/lcrMeter/index.js HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2024 10:28:41] "GET /favicon.ico HTTP/1.1" 404 -
Falha ao carregar o dispositivo: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Подробнее здесь: https://stackoverflow.com/questions/790 ... tocomplete