def find_port(self):
try:
temp_port_list = serial.tools.list_ports.comports()
except OSError:
raise OSError('Serial port not found! Try entering your port manually.')
ports = [i[0] for i in temp_port_list][::-1]
openbci_port = ''
for port in ports:
try:
s = serial.Serial(port= port, baudrate = self.baudrate, timeout=self.timeout)
s.write(b'v')
openbci_serial = self.openbci_id(s)
s.close()
if openbci_serial:
openbci_port = port;
except (OSError, serial.SerialException):
pass
if openbci_port == '':
raise OSError('Cannot find OpenBCI port')
else:
return openbci_port
open_bci_v3.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录